]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
sched: Make set_cpu_rq_start_time() a built in hotplug state
authorThomas Gleixner <tglx@linutronix.de>
Thu, 10 Mar 2016 11:54:09 +0000 (12:54 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 6 May 2016 12:58:23 +0000 (14:58 +0200)
Start distangling the maze of hotplug notifiers in the scheduler.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: rt@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/cpuhotplug.h
include/linux/sched.h
kernel/cpu.c
kernel/sched/core.c

index 5d68e15e46b779d4cb0ff4613fd77d28403c72b5..99fd1d2f76fe648f5d3488304c2205ec0cb702f4 100644 (file)
@@ -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,
index 52c4847b05e2882a72d04c3c75fc4d55c2b4a6b9..39597d0a005ed2e0fdbbda438baca3e0b8bbc791 100644 (file)
@@ -372,6 +372,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);
 
index 3e3f6e49eabbc0dc62eefc02a201f95508032dab..f46d02b966bfad43487d30c35e9638120d1a5257 100644 (file)
@@ -1236,6 +1236,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
index 8bfd7d4f1c211f50e7eab01ce3596c02116c288c..4df9aaae27a23808f5d5068cafa68eb50bcf1b0b 100644 (file)
@@ -5473,10 +5473,10 @@ static struct notifier_block migration_notifier = {
        .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);
 }
 
@@ -5486,10 +5486,6 @@ static int sched_cpu_active(struct notifier_block *nfb,
        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;
@@ -5511,6 +5507,12 @@ static int sched_cpu_inactive(struct notifier_block *nfb,
        }
 }
 
+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();
@@ -7426,7 +7428,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();