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

From: Greg Kroah-Hartman
Date: Tue Dec 13 2022 - 09:31:23 EST


On Tue, Dec 13, 2022 at 08:22:58AM -0500, Phil Auld wrote:
> On Tue, Dec 13, 2022 at 07:23:54AM +0100 Greg Kroah-Hartman wrote:
> > On Mon, Dec 12, 2022 at 02:17:58PM -0500, Phil Auld wrote:
> > > Hi,
> > >
> > > On Tue, Nov 08, 2022 at 01:24:39PM +0100 Greg Kroah-Hartman wrote:
> > > > On Tue, Nov 08, 2022 at 03:30:46PM +0530, Vishal Chourasia wrote:
> > > > >
> > > > > Thanks Greg & Peter for your direction.
> > > > >
> > > > > While we pursue the idea of having debugfs based on kernfs, we thought about
> > > > > having a boot time parameter which would disable creating and updating of the
> > > > > sched_domain debugfs files and this would also be useful even when the kernfs
> > > > > solution kicks in, as users who may not care about these debugfs files would
> > > > > benefit from a faster CPU hotplug operation.
> > > >
> > > > Ick, no, you would be adding a new user/kernel api that you will be
> > > > required to support for the next 20+ years. Just to get over a
> > > > short-term issue before you solve the problem properly.
> > >
> > > I'm not convinced moving these files from debugfs to kernfs is the right
> > > fix. That will take it from ~50 back to ~20 _minutes_ on these systems.
> > > I don't think either of those numbers is reasonable.
> > >
> > > The issue as I see it is the full rebuild for every change with no way to
> > > batch the changes. How about something like the below?
> > >
> > > This puts the domains/* files under the sched_verbose flag. About the only
> > > thing under that flag now are the detailed topology discovery printks anyway
> > > so this fits together nicely.
> > >
> > > This way the files would be off by default (assuming you don't boot with
> > > sched_verbose) and can be created at runtime by enabling verbose. Multiple
> > > changes could also be batched by disabling/makeing changes/re-enabling.
> > >
> > > It does not create a new API, uses one that is already there.
> >
> > The idea seems good, the implementation might need a bit of work :)
>
> More than the one comment below? Let me know.

No idea, resubmit a working patch and I'll review it properly :)

> > > + r = kstrtobool_from_user(ubuf, cnt, &bv);
> > > + if (!r) {
> > > + mutex_lock(&sched_domains_mutex);
> > > + r = debugfs_file_get(dentry);
> > > + if (unlikely(r))
> > > + return r;
> > > + sched_debug_verbose = bv;
> > > + debugfs_file_put(dentry);
> >
> > Why the get/put of the debugfs dentry? for just this single value?
>
> That's what debugfs_file_write_bool() does, which is where I got that since
> that's really what this is doing. I couldn't see a good way to make this
> just call that.
>
> I suppose the get/put may not be needed since the only way this should
> go away is under that mutex too.

Yes, it should not be needed.

> ... erm, yeah, that return is a problem ... I'll fix that.
>
> Also, this was originally on v6.1-rc7. I can rebase when I repost but I
> didn't want to do it on a random commit so I picked (at the time) the latest
> tag. Should I just use the head of Linux?

Yes, or linux-next.

thanks,

greg k-h