linux-stable/kernel/power
Waiman Long d3cdcc72b3 cgroup/cpuset: Make cpuset hotplug processing synchronous
[ Upstream commit 2125c0034c ]

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
d74b27d63a ("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 b22afcdf04 ("cpu/hotplug: Cure the cpusets trainwreck")
  - commit 50e7663233 ("sched/cpuset/pm: Fix cpuset vs. suspend-resume
    bugs")
  - commit 28b89b9e6f ("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
50e7663233 ("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@redhat.com>
Tested-by: Valentin Schneider <vschneid@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-27 13:52:15 +02:00
..
autosleep.c
console.c
energy_model.c PM: EM: Force device drivers to provide power in uW 2024-03-13 20:48:38 +01:00
hibernate.c PM: hibernate: Support to select compression algorithm 2024-02-22 20:03:21 +01:00
Kconfig PM: hibernate: Add support for LZ4 compression for hibernation 2024-02-05 14:30:35 +01:00
main.c PM: sleep: stats: Use locking in dpm_save_failed_dev() 2024-02-05 14:28:54 +01:00
Makefile PM: sleep: Narrow down -DDEBUG on kernel/power/ files 2022-04-13 16:34:01 +02:00
power.h PM: hibernate: Don't ignore return from set_memory_ro() 2024-02-22 20:08:03 +01:00
poweroff.c tty: sysrq: switch sysrq handlers from int to u8 2023-07-25 19:21:03 +02:00
process.c cgroup/cpuset: Make cpuset hotplug processing synchronous 2024-06-27 13:52:15 +02:00
qos.c PM: QoS: Add check to make sure CPU latency is non-negative 2023-08-22 21:37:29 +02:00
snapshot.c PM: hibernate: Don't ignore return from set_memory_ro() 2024-02-22 20:08:03 +01:00
suspend.c PM: s2idle: Make sure CPUs will wakeup directly on resume 2024-04-08 15:36:54 +02:00
suspend_test.c rtc: class: make rtc_class constant 2024-03-08 12:05:10 +01:00
swap.c Power management updates for 6.9-rc1 2024-03-13 11:40:06 -07:00
user.c PM: hibernate: Don't ignore return from set_memory_ro() 2024-02-22 20:08:03 +01:00
wakelock.c