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


Groups > linux.kernel > #1477531

[tip:smp/hotplug] kernel/softirq: Convert to hotplug state machine

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:smp/hotplug] kernel/softirq: Convert to hotplug state machine
Date Tue, 06 Sep 2016 17:30:02 +0200
Message-ID <seqtY-3JB-61@gated-at.bofh.it> (permalink)
References <s7vf4-dJ-31@gated-at.bofh.it>
Reply-To linux-kernel@vger.kernel.org, peterz@infradead.org, bigeasy@linutronix.de, tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com
Git-Commit-ID 9178e649695074fd0ef33221d1ed5829a54bb317
X-Mailer tip-git-log-daemon
Robot-ID <tip-bot.git.kernel.org>
Robot-Unsubscribe Contact <mailto:hpa@kernel.org> to get blacklisted from these emails
MIME-Version 1.0
Content-Transfer-Encoding 8bit
Content-Type text/plain; charset=UTF-8
Content-Disposition inline
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 89
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, bigeasy@linutronix.de, peterz@infradead.org, tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com
X-Original-Date Tue, 6 Sep 2016 08:22:42 -0700
X-Original-Message-ID <tip-9178e649695074fd0ef33221d1ed5829a54bb317@git.kernel.org>
X-Original-References <20160818125731.27256-7-bigeasy@linutronix.de>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1477531

Show key headers only | View raw


Commit-ID:  9178e649695074fd0ef33221d1ed5829a54bb317
Gitweb:     http://git.kernel.org/tip/9178e649695074fd0ef33221d1ed5829a54bb317
Author:     Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Thu, 18 Aug 2016 14:57:21 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 6 Sep 2016 16:20:30 +0200

kernel/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: 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 |  1 +
 kernel/softirq.c           | 27 ++++++---------------------
 2 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index e417a05..8e40f57 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -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,
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 17caf4b..c372114 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -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;

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


Thread

[tip:smp/hotplug] kernel/softirq: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-09-06 17:30 +0200

csiph-web