[PATCH OLK-6.6 0/3] backport olk6.6
*** BLURB HERE *** Chen Jinghuang (3): cpuset: Fix prefer_cpus ineffectiveness by tracking prefer_cpus cgroup/cpuset.c: Comment out early when prefer_cpus cpumask equals cgroup/cpuset.c: Adapt schduler dynamic affinity for hotplug scenarios with cgroup v2 kernel/cgroup/cpuset.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) -- 2.34.1
Offering: HULK hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/8320 -------------------------------- commit 7fd4da9c1584 ("cgroup/cpuset: Optimize cpuset_attach() on v2") skipped cpuset_attach() when the child cgroup's effective cpus and mems remained unchanged, which resulted in the configured prefer_cpus not taking effect. Add is_affinity_unchanged: when a child cpuset is configured with prefer_cpus, even if its cpus/mems are the same as the root cpuset, this function will mark the functional difference and trigger the cpuset_attach_task execution flow, ensuring the normal activation for scheduler dynamic affinity. Fixes: 21dac1062b2f ("cpuset: Introduce new interface for scheduler dynamic affinity") Signed-off-by: Chen Jinghuang <chenjinghuang2@huawei.com> --- kernel/cgroup/cpuset.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index b2a2c0d038b7..755fe05fce3d 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1022,6 +1022,16 @@ static int update_prefer_cpumask(struct cpuset *cs, struct cpuset *trialcs, return 0; } + +static inline bool prefer_cpus_updated(struct cpuset *cs, struct cpuset *oldcs) +{ + return !cpumask_equal(cs->prefer_cpus, oldcs->prefer_cpus); +} +#else +static inline bool prefer_cpus_updated(struct cpuset *cs, struct cpuset *oldcs) +{ + return false; +} #endif #ifdef CONFIG_SMP @@ -3539,7 +3549,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) * by skipping the task iteration and update. */ if (cgroup_subsys_on_dfl(cpuset_cgrp_subsys) && - !cpus_updated && !mems_updated) { + !cpus_updated && !mems_updated && !prefer_cpus_updated(cs, oldcs)) { cpuset_attach_nodemask_to = cs->effective_mems; goto out; } -- 2.34.1
Offering: HULK hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/8397 ---------------------------------------- The current logic skips updating task's prefer_cpus in a cgroup when the cgroup's prefer_cpus is unchanged. However, task's prefer_cpus may mismatch the cgroup config in some cases, causing inconsistent CPU affinity. Comment out the early return logic to ensure task's prefer_cpus are always updated on cgroup.prefer_cpus writes, aligning task and cgroup settings. Fixes: 21dac1062b2f ("cpuset: Introduce new interface for scheduler dynamic affinity") Signed-off-by: Chen Jinghuang <chenjinghuang2@huawei.com> --- kernel/cgroup/cpuset.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 755fe05fce3d..55a234e50c94 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1007,10 +1007,6 @@ static int update_prefer_cpumask(struct cpuset *cs, struct cpuset *trialcs, return retval; } - /* Nothing to do if the cpus didn't change */ - if (cpumask_equal(cs->prefer_cpus, trialcs->prefer_cpus)) - return 0; - if (!cpumask_subset(trialcs->prefer_cpus, cs->cpus_allowed)) return -EINVAL; -- 2.34.1
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
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://atomgit.com/openeuler/kernel/merge_requests/25599 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/USY... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://atomgit.com/openeuler/kernel/merge_requests/25599 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/USY...
participants (2)
-
Chen Jinghuang -
patchwork bot