提交 0a47eb22 编写于 作者: S Sebastian Andrzej Siewior 提交者: Zheng Zengkai

sched: Teach the forced-newidle balancer about CPU affinity limitation.

mainline inclusion
from mainline-v5.18-rc2
commit 386ef214
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5OOWG
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=386ef214c3c6ab111d05e1790e79475363abaa05

--------------------------------------------------------------------------

try_steal_cookie() looks at task_struct::cpus_mask to decide if the
task could be moved to `this' CPU. It ignores that the task might be in
a migration disabled section while not on the CPU. In this case the task
must not be moved otherwise per-CPU assumption are broken.

Use is_cpu_allowed(), as suggested by Peter Zijlstra, to decide if the a
task can be moved.

Fixes: d2dfa17b ("sched: Trivial forced-newidle balancer")
Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/YjNK9El+3fzGmswf@linutronix.deSigned-off-by: NLin Shengwang <linshengwang1@huawei.com>
Reviewed-by: Nlihua <hucool.lihua@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 f0cbe3af
...@@ -5045,7 +5045,7 @@ static bool try_steal_cookie(int this, int that) ...@@ -5045,7 +5045,7 @@ static bool try_steal_cookie(int this, int that)
if (p == src->core_pick || p == src->curr) if (p == src->core_pick || p == src->curr)
goto next; goto next;
if (!cpumask_test_cpu(this, &p->cpus_mask)) if (!is_cpu_allowed(p, this))
goto next; goto next;
if (p->core_occupation > dst->idle->core_occupation) if (p->core_occupation > dst->idle->core_occupation)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册