[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aLipid4JRKEac1bS@gpd4>
Date: Wed, 3 Sep 2025 22:48:09 +0200
From: Andrea Righi <arighi@...dia.com>
To: Tejun Heo <tj@...nel.org>
Cc: David Vernet <void@...ifault.com>, Changwoo Min <changwoo@...lia.com>,
sched-ext@...ts.linux.dev, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH sched_ext/for-6.18] sched_ext: Use cgroup_lock/unlock()
to synchronize against cgroup operations
On Wed, Sep 03, 2025 at 06:39:46AM -1000, Tejun Heo wrote:
> Hello,
>
> On Wed, Sep 03, 2025 at 02:44:58PM +0200, Andrea Righi wrote:
> > > static void scx_cgroup_lock(void)
> > > {
> > > - percpu_down_write(&scx_cgroup_rwsem);
> > > + percpu_down_write(&scx_cgroup_ops_rwsem);
> > > + cgroup_lock();
> > > }
> >
> > Shouldn't we acquire cgroup_lock() before scx_cgroup_ops_rwsem to avoid
> > a potential AB-BA deadlock?
>
> There's no existing ordering between the two locks, so any order should be
> safe. The reason why I put it in this particular order is because any
> cgroup_lock() holder has no reason to grab ops_rwsem now or in the future
> while the opposite direction is still unlikely but theoretically more
> possible.
Isn't scx_group_set_weight() called with cgroup_mutex held? In this case
the order is cgroup_lock() -> scx_cgroup_ops_rwsem, or am I missing
something?
Thanks,
-Andrea
Powered by blists - more mailing lists