Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

block/softirq: Convert to hotplug state machine

Install the callbacks via the state machine.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160906170457.32393-9-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Sebastian Andrzej Siewior and committed by
Thomas Gleixner
9a659f43 75e12ed6

+11 -17
+10 -17
block/blk-softirq.c
··· 78 78 } 79 79 #endif 80 80 81 - static int blk_cpu_notify(struct notifier_block *self, unsigned long action, 82 - void *hcpu) 81 + static int blk_softirq_cpu_dead(unsigned int cpu) 83 82 { 84 83 /* 85 84 * If a CPU goes away, splice its entries to the current CPU 86 85 * and trigger a run of the softirq 87 86 */ 88 - if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) { 89 - int cpu = (unsigned long) hcpu; 87 + local_irq_disable(); 88 + list_splice_init(&per_cpu(blk_cpu_done, cpu), 89 + this_cpu_ptr(&blk_cpu_done)); 90 + raise_softirq_irqoff(BLOCK_SOFTIRQ); 91 + local_irq_enable(); 90 92 91 - local_irq_disable(); 92 - list_splice_init(&per_cpu(blk_cpu_done, cpu), 93 - this_cpu_ptr(&blk_cpu_done)); 94 - raise_softirq_irqoff(BLOCK_SOFTIRQ); 95 - local_irq_enable(); 96 - } 97 - 98 - return NOTIFY_OK; 93 + return 0; 99 94 } 100 - 101 - static struct notifier_block blk_cpu_notifier = { 102 - .notifier_call = blk_cpu_notify, 103 - }; 104 95 105 96 void __blk_complete_request(struct request *req) 106 97 { ··· 171 180 INIT_LIST_HEAD(&per_cpu(blk_cpu_done, i)); 172 181 173 182 open_softirq(BLOCK_SOFTIRQ, blk_done_softirq); 174 - register_hotcpu_notifier(&blk_cpu_notifier); 183 + cpuhp_setup_state_nocalls(CPUHP_BLOCK_SOFTIRQ_DEAD, 184 + "block/softirq:dead", NULL, 185 + blk_softirq_cpu_dead); 175 186 return 0; 176 187 } 177 188 subsys_initcall(blk_softirq_init);
+1
include/linux/cpuhotplug.h
··· 23 23 CPUHP_ARM64_FPSIMD_DEAD, 24 24 CPUHP_ARM_OMAP_WAKE_DEAD, 25 25 CPUHP_IRQ_POLL_DEAD, 26 + CPUHP_BLOCK_SOFTIRQ_DEAD, 26 27 CPUHP_WORKQUEUE_PREP, 27 28 CPUHP_POWER_NUMA_PREPARE, 28 29 CPUHP_HRTIMERS_PREPARE,