]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
kernel/softirq: Convert to hotplug state machine
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 18 Aug 2016 12:57:21 +0000 (14:57 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 6 Sep 2016 16:30:22 +0000 (18:30 +0200)
Install the callbacks via the state machine.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160818125731.27256-7-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/cpuhotplug.h
kernel/softirq.c

index 854e59a426d4cebbc24e476b1d65140386f6f100..a421407a317f338844ce1c440e67053d61fc8127 100644 (file)
@@ -17,6 +17,7 @@ enum cpuhp_state {
        CPUHP_VIRT_NET_DEAD,
        CPUHP_SLUB_DEAD,
        CPUHP_MM_WRITEBACK_DEAD,
+       CPUHP_SOFTIRQ_DEAD,
        CPUHP_WORKQUEUE_PREP,
        CPUHP_POWER_NUMA_PREPARE,
        CPUHP_HRTIMERS_PREPARE,
index 17caf4b63342d7839528f367b283a386413b0362..c372114494f5f879f80defc9c613fdc31dc1c6f4 100644 (file)
@@ -700,7 +700,7 @@ void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu)
        BUG();
 }
 
-static void takeover_tasklets(unsigned int cpu)
+static int takeover_tasklets(unsigned int cpu)
 {
        /* CPU is dead, so no lock needed. */
        local_irq_disable();
@@ -723,27 +723,12 @@ static void takeover_tasklets(unsigned int cpu)
        raise_softirq_irqoff(HI_SOFTIRQ);
 
        local_irq_enable();
+       return 0;
 }
+#else
+#define takeover_tasklets      NULL
 #endif /* CONFIG_HOTPLUG_CPU */
 
-static int cpu_callback(struct notifier_block *nfb, unsigned long action,
-                       void *hcpu)
-{
-       switch (action) {
-#ifdef CONFIG_HOTPLUG_CPU
-       case CPU_DEAD:
-       case CPU_DEAD_FROZEN:
-               takeover_tasklets((unsigned long)hcpu);
-               break;
-#endif /* CONFIG_HOTPLUG_CPU */
-       }
-       return NOTIFY_OK;
-}
-
-static struct notifier_block cpu_nfb = {
-       .notifier_call = cpu_callback
-};
-
 static struct smp_hotplug_thread softirq_threads = {
        .store                  = &ksoftirqd,
        .thread_should_run      = ksoftirqd_should_run,
@@ -753,8 +738,8 @@ static struct smp_hotplug_thread softirq_threads = {
 
 static __init int spawn_ksoftirqd(void)
 {
-       register_cpu_notifier(&cpu_nfb);
-
+       cpuhp_setup_state_nocalls(CPUHP_SOFTIRQ_DEAD, "softirq:dead", NULL,
+                                 takeover_tasklets);
        BUG_ON(smpboot_register_percpu_thread(&softirq_threads));
 
        return 0;