sched/fair: Use recent_used_cpu to test p->cpus_ptr
PATCH 1/1 sched/fair: Use recent_used_cpu to test p->cpus_ptr
When checking whether a recently used CPU can be a potential idle candidate, recent_used_cpu should be used to test p->cpus_ptr as p->recent_used_cpu is not equal to recent_used_cpu and candidate decision is made based on recent_used_cpu here.
--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
@@ -7156,7 +7156,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) recent_used_cpu != target && cpus_share_cache(recent_used_cpu, target) && (available_idle_cpu(recent_used_cpu) || sched_idle_cpu(recent_used_cpu)) && - cpumask_test_cpu(p->recent_used_cpu, p->cpus_ptr) && + cpumask_test_cpu(recent_used_cpu, p->cpus_ptr) && asym_fits_cpu(task_util, util_min, util_max, recent_used_cpu)) {return recent_used_cpu; }
Signature · 1 line
2.27.0
Quoted 27 lines · On Tue, Jun 20, 2023 at 04:07:47PM +0800 Miaohe Lin wrote:
When checking whether a recently used CPU can be a potential idle candidate,
recent_used_cpushould be used to testp->cpus_ptrasp->recent_used_cpuis not equal torecent_used_cpuand candidate decision is made based onrecent_used_cpuhere.Fixes 89aafd67f28c ("sched/fair: Use prev instead of new target as recent_used_cpu")Signed-off-by Miaohe Lin <[email protected]>--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/sched/fair.c +1
-1@@ -7156,7 +7156,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) recent_used_cpu != target && cpus_share_cache(recent_used_cpu, target) && (available_idle_cpu(recent_used_cpu) || sched_idle_cpu(recent_used_cpu)) && - cpumask_test_cpu(p->recent_used_cpu, p->cpus_ptr) && + cpumask_test_cpu(recent_used_cpu, p->cpus_ptr) && asym_fits_cpu(task_util, util_min, util_max, recent_used_cpu)) {return recent_used_cpu; }Signature · 1 line
2.27.0
This looks correct to me.
Quoted 6 lines · Miaohe Lin
When checking whether a recently used CPU can be a potential idle candidate,
recent_used_cpushould be used to testp->cpus_ptrasp->recent_used_cpuis not equal torecent_used_cpuand candidate decision is made based onrecent_used_cpuhere.Fixes 89aafd67f28c ("sched/fair: Use prev instead of new target as recent_used_cpu")
Signature · 2 lines
Mel Gorman SUSE Labs
Peter Zijlstra
maintainerQuoted 9 lines · Mel Gorman
Quoted 6 lines · Miaohe Lin
When checking whether a recently used CPU can be a potential idle candidate,
recent_used_cpushould be used to testp->cpus_ptrasp->recent_used_cpuis not equal torecent_used_cpuand candidate decision is made based onrecent_used_cpuhere.Fixes 89aafd67f28c ("sched/fair: Use prev instead of new target as recent_used_cpu")Acked-by Mel Gorman <[email protected]>
Thanks!
The following commit has been merged into the sched/urgent branch of tip:
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: ae2ad293d6be143ad223f5f947cca07bcbe42595 Gitweb: https://git.kernel.org/tip/ae2ad293d6be143ad223f5f947cca07bcbe42595 Author: Miaohe Lin <[email protected]> AuthorDate: Tue, 20 Jun 2023 16:07:47 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Mon, 10 Jul 2023 09:52:30 +02:00
sched/fair: Use recent_used_cpu to test p->cpus_ptr
When checking whether a recently used CPU can be a potential idle candidate, recent_used_cpu should be used to test p->cpus_ptr as p->recent_used_cpu is not equal to recent_used_cpu and candidate decision is made based on recent_used_cpu here.
--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
@@ -7174,7 +7174,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) recent_used_cpu != target && cpus_share_cache(recent_used_cpu, target) && (available_idle_cpu(recent_used_cpu) || sched_idle_cpu(recent_used_cpu)) && - cpumask_test_cpu(p->recent_used_cpu, p->cpus_ptr) && + cpumask_test_cpu(recent_used_cpu, p->cpus_ptr) && asym_fits_cpu(task_util, util_min, util_max, recent_used_cpu)) {return recent_used_cpu; }