Re: [cgroup/for-6.19 PATCH] cgroup/cpuset: Make callback_lock a raw_spinlock_t

From: Sebastian Andrzej Siewior

Date: Thu Nov 13 2025 - 02:53:59 EST


On 2025-11-12 13:21:12 [-0500], Waiman Long wrote:
> On 11/12/25 3:51 AM, Sebastian Andrzej Siewior wrote:
> > On 2025-11-11 22:57:59 [-0500], Waiman Long wrote:
> > > The callback_lock is a spinlock_t which is acquired either to read
> > > a stable set of cpu or node masks or to modify those masks when
> > > cpuset_mutex is also acquired. Sometime it may need to go up the
> > > cgroup hierarchy while holding the lock to find the right set of masks
> > > to use. Assuming that the depth of the cgroup hierarch is finite and
> > > typically small, the lock hold time should be limited.
> > We can't assume that, can we?
> We can theoretically create a cgroup hierarchy with many levels, but no sane
> users will actually do that. If this is a concern to you, I can certainly
> drop this patch.

Someone will think this is sane and will wonder. We usually don't impose
limits but make sure things are preemptible so it does not matter.

> > > Some externally callable cpuset APIs like cpuset_cpus_allowed() and
> > cpuset_cpus_allowed() has three callers in kernel/sched/ and all use
> > GFP_KERNEL shortly before invoking the function in question.
> The current callers of these APIs are fine. What I am talking is about new
> callers that may want to call them when holding a raw_spinlock_t.

No, please don't proactive do these changes like this which are not
fixes because something was/ is broken.

> > > cpuset_mems_allowed() acquires callback_lock with irq disabled to ensure
> > This I did not find. But I would ask to rework it somehow that we don't
> > need to use raw_spinlock_t as a hammer that solves it all.
>
> OK.
>
> Cheers,
> Longman

Sebastian