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


Groups > linux.kernel > #1717977

[RFC PATCH 10/12] housekeeping: Affine unbound kthreads

From Frederic Weisbecker <fweisbec@gmail.com>
Newsgroups linux.kernel
Subject [RFC PATCH 10/12] housekeeping: Affine unbound kthreads
Date 2017-08-23 04:00 +0200
Message-ID <uht7A-2oU-43@gated-at.bofh.it> (permalink)
References <uht7z-2oU-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


We want to be able to force the kthreads affinity when we'll repinplement
isolcpus= on top of housekeeping. Unfortunately many kthreads also
override their own affinity so we may need to revisit some of them.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Wanpeng Li <kernellwp@gmail.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
---
 include/linux/housekeeping.h | 1 +
 kernel/kthread.c             | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/housekeeping.h b/include/linux/housekeeping.h
index 0959601..2a9b808 100644
--- a/include/linux/housekeeping.h
+++ b/include/linux/housekeeping.h
@@ -11,6 +11,7 @@ enum hk_flags {
 	HK_FLAG_MISC		= (1 << 2),
 	HK_FLAG_SCHED		= (1 << 3),
 	HK_FLAG_WORKQUEUE	= (1 << 4),
+	HK_FLAG_KTHREAD		= (1 << 5),
 };
 
 #ifdef CONFIG_CPU_ISOLATION
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 26db528..d4f1e63 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -21,6 +21,7 @@
 #include <linux/ptrace.h>
 #include <linux/uaccess.h>
 #include <linux/cgroup.h>
+#include <linux/housekeeping.h>
 #include <trace/events/sched.h>
 
 static DEFINE_SPINLOCK(kthread_create_lock);
@@ -317,7 +318,7 @@ struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data),
 		 * The kernel thread should not inherit these properties.
 		 */
 		sched_setscheduler_nocheck(task, SCHED_NORMAL, &param);
-		set_cpus_allowed_ptr(task, cpu_all_mask);
+		set_cpus_allowed_ptr(task, housekeeping_cpumask(HK_FLAG_KTHREAD));
 	}
 	kfree(create);
 	return task;
@@ -536,7 +537,7 @@ int kthreadd(void *unused)
 	/* Setup a clean context for our children to inherit. */
 	set_task_comm(tsk, "kthreadd");
 	ignore_signals(tsk);
-	set_cpus_allowed_ptr(tsk, cpu_all_mask);
+	set_cpus_allowed_ptr(tsk, housekeeping_cpumask(HK_FLAG_KTHREAD));
 	set_mems_allowed(node_states[N_MEMORY]);
 
 	current->flags |= PF_NOFREEZE;
-- 
2.7.4

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


Thread

[RFC 00/12] Introduce housekeeping subsystem v2 Frederic Weisbecker <fweisbec@gmail.com> - 2017-08-23 04:00 +0200
  [RFC PATCH 11/12] housekeeping: Handle nohz_full= parameter Frederic Weisbecker <fweisbec@gmail.com> - 2017-08-23 04:00 +0200
  [RFC PATCH 08/12] housekeeping: Introduce housekeeping flags Frederic Weisbecker <fweisbec@gmail.com> - 2017-08-23 04:00 +0200
  [RFC PATCH 02/12] watchdog: Use housekeeping_cpumask() instead of ad-hoc version Frederic Weisbecker <fweisbec@gmail.com> - 2017-08-23 04:00 +0200
  [RFC PATCH 04/12] housekeeping: Make housekeeping cpumask private Frederic Weisbecker <fweisbec@gmail.com> - 2017-08-23 04:00 +0200
  [RFC PATCH 06/12] housekeeping: Rename is_housekeeping_cpu to housekeeping_cpu Frederic Weisbecker <fweisbec@gmail.com> - 2017-08-23 04:00 +0200
  [RFC PATCH 12/12] housekeeping: Reimplement isolcpus on housekeeping Frederic Weisbecker <fweisbec@gmail.com> - 2017-08-23 04:00 +0200
    Re: [RFC PATCH 12/12] housekeeping: Reimplement isolcpus on  housekeeping Christopher Lameter <cl@linux.com> - 2017-08-23 17:00 +0200
      Re: [RFC PATCH 12/12] housekeeping: Reimplement isolcpus on  housekeeping Frederic Weisbecker <fweisbec@gmail.com> - 2017-08-24 15:30 +0200
  [RFC PATCH 07/12] housekeeping: Move it under own config, independant from NO_HZ Frederic Weisbecker <fweisbec@gmail.com> - 2017-08-23 04:00 +0200
  [RFC PATCH 10/12] housekeeping: Affine unbound kthreads Frederic Weisbecker <fweisbec@gmail.com> - 2017-08-23 04:00 +0200

csiph-web