]> git.baikalelectronics.ru Git - kernel.git/commit
sched/core: Optimize ttwu() spinning on p->on_cpu
authorPeter Zijlstra <peterz@infradead.org>
Sun, 24 May 2020 20:29:55 +0000 (21:29 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 25 May 2020 05:01:44 +0000 (07:01 +0200)
commit9c1854c40af7989dfec098098e5c1690f55a5fb7
treef1e77c6930f4ead3cfb4e231fd5fede2779b1cf5
parent632165647e11c67993c307d48f862b6df04d0939
sched/core: Optimize ttwu() spinning on p->on_cpu

Both Rik and Mel reported seeing ttwu() spend significant time on:

  smp_cond_load_acquire(&p->on_cpu, !VAL);

Attempt to avoid this by queueing the wakeup on the CPU that owns the
p->on_cpu value. This will then allow the ttwu() to complete without
further waiting.

Since we run schedule() with interrupts disabled, the IPI is
guaranteed to happen after p->on_cpu is cleared, this is what makes it
safe to queue early.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Jirka Hladky <jhladky@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: valentin.schneider@arm.com
Cc: Hillf Danton <hdanton@sina.com>
Cc: Rik van Riel <riel@surriel.com>
Link: https://lore.kernel.org/r/20200524202956.27665-2-mgorman@techsingularity.net
kernel/sched/core.c