[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xhsmhr0ffang5.mognet@vschneid-thinkpadt14sgen2i.remote.csb>
Date: Mon, 08 Apr 2024 17:22:50 +0200
From: Valentin Schneider <vschneid@...hat.com>
To: Waiman Long <longman@...hat.com>, Tejun Heo <tj@...nel.org>, Zefan Li
<lizefan.x@...edance.com>, Johannes Weiner <hannes@...xchg.org>, Thomas
Gleixner <tglx@...utronix.de>, Peter Zijlstra <peterz@...radead.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <len.brown@...el.com>,
Pavel Machek <pavel@....cz>, Shuah Khan <shuah@...nel.org>
Cc: linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
linux-pm@...r.kernel.org, linux-kselftest@...r.kernel.org, Frederic
Weisbecker <frederic@...nel.org>, "Paul E. McKenney" <paulmck@...nel.org>,
Ingo Molnar <mingo@...nel.org>, Anna-Maria Behnsen
<anna-maria@...utronix.de>, Alex Shi <alexs@...nel.org>, Vincent Guittot
<vincent.guittot@...aro.org>, Michal Koutný
<mkoutny@...e.com>, Waiman
Long <longman@...hat.com>
Subject: Re: [PATCH v2 1/2] cgroup/cpuset: Make cpuset hotplug processing
synchronous
On 04/04/24 09:47, Waiman Long wrote:
> Since commit 3a5a6d0c2b03("cpuset: don't nest cgroup_mutex inside
> get_online_cpus()"), cpuset hotplug was done asynchronously via a work
> function. This is to avoid recursive locking of cgroup_mutex.
>
> Since then, the cgroup locking scheme has changed quite a bit. A
> cpuset_mutex was introduced to protect cpuset specific operations.
> The cpuset_mutex is then replaced by a cpuset_rwsem. With commit
> d74b27d63a8b ("cgroup/cpuset: Change cpuset_rwsem and hotplug lock
> order"), cpu_hotplug_lock is acquired before cpuset_rwsem. Later on,
> cpuset_rwsem is reverted back to cpuset_mutex. All these locking changes
> allow the hotplug code to call into cpuset core directly.
>
> The following commits were also merged due to the asynchronous nature
> of cpuset hotplug processing.
>
> - commit b22afcdf04c9 ("cpu/hotplug: Cure the cpusets trainwreck")
> - commit 50e76632339d ("sched/cpuset/pm: Fix cpuset vs. suspend-resume
> bugs")
> - commit 28b89b9e6f7b ("cpuset: handle race between CPU hotplug and
> cpuset_hotplug_work")
>
> Clean up all these bandages by making cpuset hotplug
> processing synchronous again with the exception that the call to
> cgroup_transfer_tasks() to transfer tasks out of an empty cgroup v1
> cpuset, if necessary, will still be done via a work function due to the
> existing cgroup_mutex -> cpu_hotplug_lock dependency. It is possible
> to reverse that dependency, but that will require updating a number of
> different cgroup controllers. This special hotplug code path should be
> rarely taken anyway.
>
> As all the cpuset states will be updated by the end of the hotplug
> operation, we can revert most the above commits except commit
> 50e76632339d ("sched/cpuset/pm: Fix cpuset vs. suspend-resume bugs")
> which is partially reverted. Also removing some cpus_read_lock trylock
> attempts in the cpuset partition code as they are no longer necessary
> since the cpu_hotplug_lock is now held for the whole duration of the
> cpuset hotplug code path.
>
> Signed-off-by: Waiman Long <longman@...hat.com>
Tested-by: Valentin Schneider <vschneid@...hat.com>
Powered by blists - more mailing lists