Message ID | 20230306200849.376804-2-longman@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series | cgroup/cpuset: Miscellaneous updates | expand |
On Mon, Mar 06, 2023 at 03:08:45PM -0500, Waiman Long <longman@redhat.com> wrote: > If a hotplug event doesn't affect the current cpuset, there is no point > to call hotplug_update_tasks() or hotplug_update_tasks_legacy(). So > just skip it. This skips "insane" modification of cs->cpus_allowed in hotplug_update_tasks_legacy() but assuming cs->cpus_allowed is kept in sync with cs->effective_cpus on v1, it is OK to skip the update based only on effective_cpus check. Hence, > kernel/cgroup/cpuset.c | 3 +++ > 1 file changed, 3 insertions(+) Reviewed-by: Michal Koutný <mkoutny@suse.com>
On 3/14/23 12:50, Michal Koutný wrote: > On Mon, Mar 06, 2023 at 03:08:45PM -0500, Waiman Long <longman@redhat.com> wrote: >> If a hotplug event doesn't affect the current cpuset, there is no point >> to call hotplug_update_tasks() or hotplug_update_tasks_legacy(). So >> just skip it. > This skips "insane" modification of cs->cpus_allowed in > hotplug_update_tasks_legacy() but assuming cs->cpus_allowed is kept in > sync with cs->effective_cpus on v1, it is OK to skip the update based > only on effective_cpus check. Yes, effective_cpus is equivalent to cpus_allowed in v1 unless you mount the cpuset with the cpuset_v2_mode flag which will behave more like v2 where effective_cpus is still the key. Cheers, Longman
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 636f1c682ac0..a801abad3bac 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -3508,6 +3508,8 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp) update_tasks: cpus_updated = !cpumask_equal(&new_cpus, cs->effective_cpus); mems_updated = !nodes_equal(new_mems, cs->effective_mems); + if (!cpus_updated && !mems_updated) + goto unlock; /* Hotplug doesn't affect this cpuset */ if (mems_updated) check_insane_mems_config(&new_mems); @@ -3519,6 +3521,7 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp) hotplug_update_tasks_legacy(cs, &new_cpus, &new_mems, cpus_updated, mems_updated); +unlock: percpu_up_write(&cpuset_rwsem); }
If a hotplug event doesn't affect the current cpuset, there is no point to call hotplug_update_tasks() or hotplug_update_tasks_legacy(). So just skip it. Signed-off-by: Waiman Long <longman@redhat.com> --- kernel/cgroup/cpuset.c | 3 +++ 1 file changed, 3 insertions(+)