sched/debug: CPU hotplug operation suffers in a large cpu systems

Greg Kroah-Hartman gregkh at linuxfoundation.org
Tue Oct 18 22:04:40 AEDT 2022


On Tue, Oct 18, 2022 at 04:07:06PM +0530, Vishal Chourasia wrote:
> On Mon, Oct 17, 2022 at 04:54:11PM +0200, Greg Kroah-Hartman wrote:
> > On Mon, Oct 17, 2022 at 04:19:31PM +0200, Peter Zijlstra wrote:
> > > 
> > > +GregKH who actually knows about debugfs.
> > > 
> > > On Mon, Oct 17, 2022 at 06:40:49PM +0530, Vishal Chourasia wrote:
> > > > smt=off operation on system with 1920 CPUs is taking approx 59 mins on v5.14
> > > > versus 29 mins on v5.11 measured using:
> > > > # time ppc64_cpu --smt=off
> > > > 
> > > > 
> > > > |--------------------------------+----------------+--------------|
> > > > | method                         | sysctl         | debugfs      |
> > > > |--------------------------------+----------------+--------------|
> > > > | unregister_sysctl_table        |   0.020050 s   | NA           |
> > > > | build_sched_domains            |   3.090563 s   | 3.119130 s   |
> > > > | register_sched_domain_sysctl   |   0.065487 s   | NA           |
> > > > | update_sched_domain_debugfs    |   NA           | 2.791232 s   |
> > > > | partition_sched_domains_locked |   3.195958 s   | 5.933254 s   |
> > > > |--------------------------------+----------------+--------------|
> > > > 
> > > > Note: partition_sched_domains_locked internally calls build_sched_domains
> > > >       and calls other functions respective to what's being currently used to
> > > >       export information i.e. sysctl or debugfs
> > > > 
> > > > Above numbers are quoted from the case where we tried offlining 1 cpu in system
> > > > with 1920 online cpus.
> > > > 
> > > > From the above table, register_sched_domain_sysctl and
> > > > unregister_sysctl_table collectively took ~0.085 secs, whereas
> > > > update_sched_domain_debugfs took ~2.79 secs. 
> > > > 
> > > > Root cause:
> > > > 
> > > > The observed regression stems from the way these two pseudo-filesystems handle
> > > > creation and deletion of files and directories internally.  
> > 
> > Yes, debugfs is not optimized for speed or memory usage at all.  This
> > happens to be the first code path I have seen that cares about this for
> > debugfs files.
> > 
> > You can either work on not creating so many debugfs files (do you really
> > really need all of them all the time?)  Or you can work on moving
> > debugfs to use kernfs as the backend logic, which will save you both
> > speed and memory usage overall as kernfs is used to being used on
> > semi-fast paths.
> > 
> > Maybe do both?
> > 
> > hope this helps,
> > 
> > greg k-h
> 
> Yes, we need to create 7-8 files per domain per CPU, eventually ending up
> creating a lot of files. 

Why do you need to?  What tools require these debugfs files to be
present?

And if you only have 7-8 files per CPU, that does not seem like a lot of
files overall (14000-16000)?  If you only offline 1 cpu, how is removing
7 or 8 files a bottleneck?  Do you really offline 1999 cpus for a 2k
system?

> Is there a possibility of reverting back to /proc/sys/kernel/sched_domain/?

No, these are debugging-only things, they do not belong in /proc/

If you rely on them for real functionality, that's a different story,
but I want to know what tool uses them and for what functionality as
debugfs should never be relied on for normal operation of a system.

thanks,

greg k-h


More information about the Linuxppc-dev mailing list