[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aLhvUpkanqxNHyZe@slm.duckdns.org>
Date: Wed, 3 Sep 2025 06:39:46 -1000
From: Tejun Heo <tj@...nel.org>
To: Andrea Righi <arighi@...dia.com>
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
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.
Thanks.
--
tejun
Powered by blists - more mailing lists