Re: [PATCH] sched/fair: Optimize select_idle_cpu

From: chengjian (D)
Date: Thu Dec 12 2019 - 20:51:47 EST

On 2019/12/12 23:04, Peter Zijlstra wrote:
On Thu, Dec 12, 2019 at 10:41:02PM +0800, Cheng Jian wrote:
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 08a233e97a01..16a29b570803 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5834,6 +5834,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
s64 delta;
int this = smp_processor_id();
int cpu, nr = INT_MAX, si_cpu = -1;
+ struct cpumask cpus;
NAK, you must not put a cpumask on stack.


Hi, Peter

ÂÂÂ I saw the same work in select_idle_core, and I was wondering why the per_cpu variable was

needed for this yesterday. Now I think I probably understand : cpumask may be too large,

putting it on the stack may cause overflow. Is this correct ?

ÂÂÂ I'm sorry I made a mistake like this. I will fix it in v2

ÂÂÂ Thank you very much.

ÂÂÂÂÂÂÂ -- Cheng Jian