Offering: HULK hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/8449 ---------------------------------------- commit 21dac1062b2f only adapted cgroup v1 for scheduler dynamic affinity in hotplug scenarios. This patch ensures that cpuset.preferred_cpus is properly synchronized when CPU hotplug events occur in cgroup v2. Fixes: 21dac1062b2f ("cpuset: Introduce new interface for scheduler dynamic affinity") Signed-off-by: Chen Jinghuang <chenjinghuang2@huawei.com> --- kernel/cgroup/cpuset.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 55a234e50c94..f211fe201b9e 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -4579,6 +4579,13 @@ hotplug_update_tasks(struct cpuset *cs, update_tasks_cpumask(cs, new_cpus); if (mems_updated) update_tasks_nodemask(cs); + +#ifdef CONFIG_QOS_SCHED_DYNAMIC_AFFINITY + if (!cpumask_subset(cs->prefer_cpus, cs->effective_cpus)) { + cpumask_and(cs->prefer_cpus, cs->prefer_cpus, cs->effective_cpus); + update_tasks_prefer_cpumask(cs); + } +#endif } static bool force_rebuild; -- 2.34.1