[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1428520285-4609-1-git-send-email-cmetcalf@ezchip.com>
Date: Wed, 8 Apr 2015 15:11:24 -0400
From: <cmetcalf@...hip.com>
To: Frederic Weisbecker <fweisbec@...il.com>,
Don Zickus <dzickus@...hat.com>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Andrew Jones <drjones@...hat.com>,
chai wen <chaiw.fnst@...fujitsu.com>,
Ulrich Obergfell <uobergfe@...hat.com>,
Fabian Frederick <fabf@...net.be>,
Aaron Tomlin <atomlin@...hat.com>,
Ben Zhang <benzh@...omium.org>,
"Christoph Lameter" <cl@...ux.com>,
Gilad Ben-Yossef <gilad@...yossef.com>,
"Steven Rostedt" <rostedt@...dmis.org>,
<linux-kernel@...r.kernel.org>, "Jonathan Corbet" <corbet@....net>,
<linux-doc@...r.kernel.org>, Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>
CC: Chris Metcalf <cmetcalf@...hip.com>
Subject: [PATCH v6 1/2] smpboot: allow excluding cpus from the smpboot threads
From: Chris Metcalf <cmetcalf@...hip.com>
This change allows some cores to be excluded from running the
smp_hotplug_thread tasks. The motivating example for this is
the watchdog threads, which by default we don't want to run
on any enabled nohz_full cores.
Signed-off-by: Chris Metcalf <cmetcalf@...hip.com>
---
v6: change from an "exclude" data pointer to a more generic
valid_cpu() callback [Frederic]
include/linux/smpboot.h | 3 +++
kernel/smpboot.c | 11 ++++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
index d600afb21926..4648a4576ae4 100644
--- a/include/linux/smpboot.h
+++ b/include/linux/smpboot.h
@@ -27,6 +27,8 @@ struct smpboot_thread_data;
* @pre_unpark: Optional unpark function, called before the thread is
* unparked (cpu online). This is not guaranteed to be
* called on the target cpu of the thread. Careful!
+ * @valid_cpu: Optional function, called when creating the threads,
+ * to limit the set of cpus on which threads are created.
* @selfparking: Thread is not parked by the park function.
* @thread_comm: The base name of the thread
*/
@@ -41,6 +43,7 @@ struct smp_hotplug_thread {
void (*park)(unsigned int cpu);
void (*unpark)(unsigned int cpu);
void (*pre_unpark)(unsigned int cpu);
+ int (*valid_cpu)(unsigned int cpu);
bool selfparking;
const char *thread_comm;
};
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index c697f73d82d6..6ffc2dacb94a 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -173,6 +173,9 @@ __smpboot_create_thread(struct smp_hotplug_thread *ht, unsigned int cpu)
if (tsk)
return 0;
+ if (ht->valid_cpu && !ht->valid_cpu(cpu))
+ return 0;
+
td = kzalloc_node(sizeof(*td), GFP_KERNEL, cpu_to_node(cpu));
if (!td)
return -ENOMEM;
@@ -221,9 +224,11 @@ static void smpboot_unpark_thread(struct smp_hotplug_thread *ht, unsigned int cp
{
struct task_struct *tsk = *per_cpu_ptr(ht->store, cpu);
- if (ht->pre_unpark)
- ht->pre_unpark(cpu);
- kthread_unpark(tsk);
+ if (tsk) {
+ if (ht->pre_unpark)
+ ht->pre_unpark(cpu);
+ kthread_unpark(tsk);
+ }
}
void smpboot_unpark_threads(unsigned int cpu)
--
2.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists