Skip to content

Commit 949338e

Browse files
committed
cpu/hotplug: Move scheduler cpu_online notifier to hotplug core
Move the scheduler cpu online notifier part to the hotplug core. This is anyway the highest priority callback and we need that functionality right now for the next changes. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: linux-arch@vger.kernel.org Cc: Rik van Riel <riel@redhat.com> Cc: Rafael Wysocki <rafael.j.wysocki@intel.com> Cc: "Srivatsa S. Bhat" <srivatsa@mit.edu> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Sebastian Siewior <bigeasy@linutronix.de> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Tejun Heo <tj@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Paul McKenney <paulmck@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul Turner <pjt@google.com> Link: http://lkml.kernel.org/r/20160226182341.200791046@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 5b7aa87 commit 949338e

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

include/linux/cpuhotplug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ enum cpuhp_state {
1010
CPUHP_AP_NOTIFY_STARTING,
1111
CPUHP_AP_ONLINE,
1212
CPUHP_TEARDOWN_CPU,
13+
CPUHP_CPU_SET_ACTIVE,
1314
CPUHP_NOTIFY_ONLINE,
1415
CPUHP_ONLINE_DYN,
1516
CPUHP_ONLINE_DYN_END = CPUHP_ONLINE_DYN + 30,

kernel/cpu.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,19 @@ void notify_cpu_starting(unsigned int cpu)
666666
}
667667
}
668668

669+
/*
670+
* Called from the idle task. We need to set active here, so we can kick off
671+
* the stopper thread.
672+
*/
673+
static int cpuhp_set_cpu_active(unsigned int cpu)
674+
{
675+
/* The cpu is marked online, set it active now */
676+
set_cpu_active(cpu, true);
677+
/* Unpark the stopper thread */
678+
stop_machine_unpark(cpu);
679+
return 0;
680+
}
681+
669682
static void undo_cpu_up(unsigned int cpu, struct cpuhp_cpu_state *st)
670683
{
671684
for (st->state--; st->state > st->target; st->state--) {
@@ -941,6 +954,11 @@ static struct cpuhp_step cpuhp_bp_states[] = {
941954
.teardown = takedown_cpu,
942955
.cant_stop = true,
943956
},
957+
[CPUHP_CPU_SET_ACTIVE] = {
958+
.name = "cpu:active",
959+
.startup = cpuhp_set_cpu_active,
960+
.teardown = NULL,
961+
},
944962
[CPUHP_NOTIFY_ONLINE] = {
945963
.name = "notify:online",
946964
.startup = notify_online,

kernel/sched/core.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5692,16 +5692,6 @@ static int sched_cpu_active(struct notifier_block *nfb,
56925692
set_cpu_rq_start_time();
56935693
return NOTIFY_OK;
56945694

5695-
case CPU_ONLINE:
5696-
/*
5697-
* At this point a starting CPU has marked itself as online via
5698-
* set_cpu_online(). But it might not yet have marked itself
5699-
* as active, which is essential from here on.
5700-
*/
5701-
set_cpu_active(cpu, true);
5702-
stop_machine_unpark(cpu);
5703-
return NOTIFY_OK;
5704-
57055695
case CPU_DOWN_FAILED:
57065696
set_cpu_active(cpu, true);
57075697
return NOTIFY_OK;

0 commit comments

Comments
 (0)