Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1355072

[patch 03/15] sched: Make set_cpu_rq_start_time() a built in hotplug state

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject [patch 03/15] sched: Make set_cpu_rq_start_time() a built in hotplug state
Date 2016-03-10 13:10 +0100
Message-ID <rb7zJ-6OQ-49@gated-at.bofh.it> (permalink)
References <rb7zI-6OQ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Start distangling the maze of hotplug notifiers in the scheduler.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/cpuhotplug.h |    1 +
 include/linux/sched.h      |    1 +
 kernel/cpu.c               |    6 ++++++
 kernel/sched/core.c        |   16 +++++++++-------
 4 files changed, 17 insertions(+), 7 deletions(-)

--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -8,6 +8,7 @@ enum cpuhp_state {
 	CPUHP_BRINGUP_CPU,
 	CPUHP_AP_IDLE_DEAD,
 	CPUHP_AP_OFFLINE,
+	CPUHP_AP_SCHED_STARTING,
 	CPUHP_AP_NOTIFY_STARTING,
 	CPUHP_AP_ONLINE,
 	CPUHP_TEARDOWN_CPU,
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -373,6 +373,7 @@ extern void cpu_init (void);
 extern void trap_init(void);
 extern void update_process_times(int user);
 extern void scheduler_tick(void);
+extern int sched_cpu_starting(unsigned int cpu);
 
 extern void sched_show_task(struct task_struct *p);
 
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1217,6 +1217,12 @@ static struct cpuhp_step cpuhp_ap_states
 		.name			= "ap:offline",
 		.cant_stop		= true,
 	},
+	/* First state is scheduler control. Interrupts are disabled */
+	[CPUHP_AP_SCHED_STARTING] = {
+		.name			= "sched:starting",
+		.startup		= sched_cpu_starting,
+		.teardown		= NULL,
+	},
 	/*
 	 * Low level startup/teardown notifiers. Run with interrupts
 	 * disabled. Will be removed once the notifiers are converted to
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5711,10 +5711,10 @@ static struct notifier_block migration_n
 	.priority = CPU_PRI_MIGRATION,
 };
 
-static void set_cpu_rq_start_time(void)
+static void set_cpu_rq_start_time(unsigned int cpu)
 {
-	int cpu = smp_processor_id();
 	struct rq *rq = cpu_rq(cpu);
+
 	rq->age_stamp = sched_clock_cpu(cpu);
 }
 
@@ -5724,10 +5724,6 @@ static int sched_cpu_active(struct notif
 	int cpu = (long)hcpu;
 
 	switch (action & ~CPU_TASKS_FROZEN) {
-	case CPU_STARTING:
-		set_cpu_rq_start_time();
-		return NOTIFY_OK;
-
 	case CPU_DOWN_FAILED:
 		set_cpu_active(cpu, true);
 		return NOTIFY_OK;
@@ -5749,6 +5745,12 @@ static int sched_cpu_inactive(struct not
 	}
 }
 
+int sched_cpu_starting(unsigned int cpu)
+{
+	set_cpu_rq_start_time(cpu);
+	return 0;
+}
+
 static int __init migration_init(void)
 {
 	void *cpu = (void *)(long)smp_processor_id();
@@ -7659,7 +7661,7 @@ void __init sched_init(void)
 	if (cpu_isolated_map == NULL)
 		zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
 	idle_thread_set_boot_cpu();
-	set_cpu_rq_start_time();
+	set_cpu_rq_start_time(smp_processor_id());
 #endif
 	init_sched_fair_class();
 

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[patch 00/15] cpu/hotplug: Convert scheduler to hotplug state machine Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 14/15] sched/fair: Make ilb_notifier an explicit call Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 07/15] sched/hotplug: Convert cpu_[in]active notifiers to  state machine Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 01/15] cpu/hotplug: Document states better Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 10/15] sched/migration: Move calc_load_migrate() into CPU_DYING Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 13/15] sched/hotplug: Make activate() the last hotplug step Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 05/15] sched: Consolidate the notifier maze Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 09/15] sched/migration: Move prepare transition to  SCHED_STARTING state Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 08/15] sched,  hotplug: Move sync_rcu to be with set_cpu_active(false) Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 06/15] sched: Move sched_domains_numa_masks_clear() to  DOWN_PREPARE Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 11/15] sched/migration: Move CPU_ONLINE into scheduler state Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 03/15] sched: Make set_cpu_rq_start_time() a built in hotplug  state Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 12/15] sched/hotplug: Move migration CPU_DYING to  sched_cpu_dying() Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 15/15] sched: Make hrtick_notifier an explicit call Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:10 +0100
  [patch 04/15] sched: Allow hotplug notifiers to be setup early Thomas Gleixner <tglx@linutronix.de> - 2016-03-10 13:20 +0100

csiph-web