Skip to content

(Was: sched: start stopper early)

Oleg Nesterov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3sched: select_task_rq() should check cpu_active() like select_fallback_rq()kernel/sched/core.c+8 -77 replies
2/3sched: change select_fallback_rq() to use for_each_cpu_and()kernel/sched/core.c+6 -80 replies
3/3sched: don't scan all-offline ->cpus_allowed twice if !CONFIG_CPUSETSkernel/sched/core.c+7 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] (Was: sched: start stopper early)

To avoid the confusion, this has nothing to do with "stop_machine" changes we discuss in another thread, but

Quoted 16 lines · Oleg Nesterov

Review static int sched_cpu_active(struct notifier_block *nfb, · line 5343

Quoted 12 lines
(quoted diff) +2 -1
 	case CPU_ONLINE:
+		stop_machine_unpark(cpu);
 		/*
 		 * At this point a starting CPU has marked itself as online via
 		 * set_cpu_online(). But it might not yet have marked itself
@@ -5337,7 +5340,7 @@ static int sched_cpu_active(struct notifier_block *nfb,
 		 * Thus, fall-through and help the starting CPU along.
 		 */
 	case CPU_DOWN_FAILED:
-		set_cpu_active((long)hcpu, true);
+		set_cpu_active(cpu, true);

On a second thought, we can't do this (and your initial change has the same problem).

Quoted 3 lines

We can not wakeup it before set_cpu_active(). This can lead to the same problem fixed by dd9d3843755da95f6 "sched: Fix cpu_active_mask/ cpu_online_mask race".

OTOH, I don't understand why do we actually need this fix... Or, iow I don't really understand the cpu_active() checks in select_fallback_rq().

Looks like we have some strange arch/ which has the "unsafe" online && !active window, but then it is not clear why it is safe to mark it active in sched_cpu_active(CPU_ONLINE). Confused.

And I am even more confused by the fact that select_fallback_rq() checks cpu_active(), but select_task_rq() doesn't. This can't be right in any case.

Oleg.

 kernel/sched/core.c |   41 +++++++++++++++++++++--------------------
 1 files changed, 21 insertions(+), 20 deletions(-)