From: tip-bot for Frederic Weisbecker <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: riel@redhat.com, lcapitulino@redhat.com,
linux-kernel@vger.kernel.org, mingo@kernel.org, cl@linux.com,
hpa@zytor.com, kernellwp@gmail.com,
torvalds@linux-foundation.org, peterz@infradead.org,
efault@gmx.de, tglx@linutronix.de, paulmck@linux.vnet.ibm.com,
cmetcalf@mellanox.com, frederic@kernel.org
Subject: [tip:sched/core] sched/isolation: Introduce housekeeping flags
Date: Fri, 27 Oct 2017 05:04:42 -0700 [thread overview]
Message-ID: <tip-de201559df872f83d0c08fb4effe3efd28e6cbc8@git.kernel.org> (raw)
In-Reply-To: <1509072159-31808-9-git-send-email-frederic@kernel.org>
Commit-ID: de201559df872f83d0c08fb4effe3efd28e6cbc8
Gitweb: https://git.kernel.org/tip/de201559df872f83d0c08fb4effe3efd28e6cbc8
Author: Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Fri, 27 Oct 2017 04:42:35 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 27 Oct 2017 09:55:29 +0200
sched/isolation: Introduce housekeeping flags
Before we implement isolcpus under housekeeping, we need the isolation
features to be more finegrained. For example some people want NOHZ_FULL
without the full scheduler isolation, others want full scheduler
isolation without NOHZ_FULL.
So let's cut all these isolation features piecewise, at the risk of
overcutting it right now. We can still merge some flags later if they
always make sense together.
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Wanpeng Li <kernellwp@gmail.com>
Link: http://lkml.kernel.org/r/1509072159-31808-9-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
drivers/net/ethernet/tile/tilegx.c | 4 ++--
include/linux/sched/isolation.h | 26 +++++++++++++++++---------
kernel/rcu/tree_plugin.h | 2 +-
kernel/rcu/update.c | 2 +-
kernel/sched/core.c | 8 ++++----
kernel/sched/fair.c | 2 +-
kernel/sched/isolation.c | 26 +++++++++++++++-----------
kernel/watchdog.c | 3 ++-
8 files changed, 43 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
index 27a3272..b3e5816 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -2270,8 +2270,8 @@ static int __init tile_net_init_module(void)
tile_net_dev_init(name, mac);
if (!network_cpus_init())
- cpumask_and(&network_cpus_map, housekeeping_cpumask(),
- cpu_online_mask);
+ cpumask_and(&network_cpus_map,
+ housekeeping_cpumask(HK_FLAG_MISC), cpu_online_mask);
return 0;
}
diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index 93ac2367..9bb753e 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -5,35 +5,43 @@
#include <linux/init.h>
#include <linux/tick.h>
+enum hk_flags {
+ HK_FLAG_TIMER = 1,
+ HK_FLAG_RCU = (1 << 1),
+ HK_FLAG_MISC = (1 << 2),
+ HK_FLAG_SCHED = (1 << 3),
+};
+
#ifdef CONFIG_CPU_ISOLATION
DECLARE_STATIC_KEY_FALSE(housekeeping_overriden);
-extern int housekeeping_any_cpu(void);
-extern const struct cpumask *housekeeping_cpumask(void);
-extern void housekeeping_affine(struct task_struct *t);
-extern bool housekeeping_test_cpu(int cpu);
+extern int housekeeping_any_cpu(enum hk_flags flags);
+extern const struct cpumask *housekeeping_cpumask(enum hk_flags flags);
+extern void housekeeping_affine(struct task_struct *t, enum hk_flags flags);
+extern bool housekeeping_test_cpu(int cpu, enum hk_flags flags);
extern void __init housekeeping_init(void);
#else
-static inline int housekeeping_any_cpu(void)
+static inline int housekeeping_any_cpu(enum hk_flags flags)
{
return smp_processor_id();
}
-static inline const struct cpumask *housekeeping_cpumask(void)
+static inline const struct cpumask *housekeeping_cpumask(enum hk_flags flags)
{
return cpu_possible_mask;
}
-static inline void housekeeping_affine(struct task_struct *t) { }
+static inline void housekeeping_affine(struct task_struct *t,
+ enum hk_flags flags) { }
static inline void housekeeping_init(void) { }
#endif /* CONFIG_CPU_ISOLATION */
-static inline bool housekeeping_cpu(int cpu)
+static inline bool housekeeping_cpu(int cpu, enum hk_flags flags)
{
#ifdef CONFIG_CPU_ISOLATION
if (static_branch_unlikely(&housekeeping_overriden))
- return housekeeping_test_cpu(cpu);
+ return housekeeping_test_cpu(cpu, flags);
#endif
return true;
}
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index c7632f5..34125d2 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2584,7 +2584,7 @@ static void rcu_bind_gp_kthread(void)
if (!tick_nohz_full_enabled())
return;
- housekeeping_affine(current);
+ housekeeping_affine(current, HK_FLAG_RCU);
}
/* Record the current task on dyntick-idle entry. */
diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index 79abeb0..e3e60ef 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -719,7 +719,7 @@ static int __noreturn rcu_tasks_kthread(void *arg)
LIST_HEAD(rcu_tasks_holdouts);
/* Run on housekeeping CPUs by default. Sysadm can move if desired. */
- housekeeping_affine(current);
+ housekeeping_affine(current, HK_FLAG_RCU);
/*
* Each pass through the following loop makes one check for
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d0fb448d..2210c02 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -527,7 +527,7 @@ int get_nohz_timer_target(void)
int i, cpu = smp_processor_id();
struct sched_domain *sd;
- if (!idle_cpu(cpu) && housekeeping_cpu(cpu))
+ if (!idle_cpu(cpu) && housekeeping_cpu(cpu, HK_FLAG_TIMER))
return cpu;
rcu_read_lock();
@@ -536,15 +536,15 @@ int get_nohz_timer_target(void)
if (cpu == i)
continue;
- if (!idle_cpu(i) && housekeeping_cpu(i)) {
+ if (!idle_cpu(i) && housekeeping_cpu(i, HK_FLAG_TIMER)) {
cpu = i;
goto unlock;
}
}
}
- if (!housekeeping_cpu(cpu))
- cpu = housekeeping_any_cpu();
+ if (!housekeeping_cpu(cpu, HK_FLAG_TIMER))
+ cpu = housekeeping_any_cpu(HK_FLAG_TIMER);
unlock:
rcu_read_unlock();
return cpu;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index cdece8f..f755de8 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9027,7 +9027,7 @@ void nohz_balance_enter_idle(int cpu)
return;
/* Spare idle load balancing on CPUs that don't want to be disturbed: */
- if (!housekeeping_cpu(cpu))
+ if (!housekeeping_cpu(cpu, HK_FLAG_SCHED))
return;
if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index bb8ba19..37a138a 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -15,37 +15,39 @@
DEFINE_STATIC_KEY_FALSE(housekeeping_overriden);
EXPORT_SYMBOL_GPL(housekeeping_overriden);
static cpumask_var_t housekeeping_mask;
+static unsigned int housekeeping_flags;
-int housekeeping_any_cpu(void)
+int housekeeping_any_cpu(enum hk_flags flags)
{
if (static_branch_unlikely(&housekeeping_overriden))
- return cpumask_any_and(housekeeping_mask, cpu_online_mask);
-
+ if (housekeeping_flags & flags)
+ return cpumask_any_and(housekeeping_mask, cpu_online_mask);
return smp_processor_id();
}
EXPORT_SYMBOL_GPL(housekeeping_any_cpu);
-const struct cpumask *housekeeping_cpumask(void)
+const struct cpumask *housekeeping_cpumask(enum hk_flags flags)
{
if (static_branch_unlikely(&housekeeping_overriden))
- return housekeeping_mask;
-
+ if (housekeeping_flags & flags)
+ return housekeeping_mask;
return cpu_possible_mask;
}
EXPORT_SYMBOL_GPL(housekeeping_cpumask);
-void housekeeping_affine(struct task_struct *t)
+void housekeeping_affine(struct task_struct *t, enum hk_flags flags)
{
if (static_branch_unlikely(&housekeeping_overriden))
- set_cpus_allowed_ptr(t, housekeeping_mask);
+ if (housekeeping_flags & flags)
+ set_cpus_allowed_ptr(t, housekeeping_mask);
}
EXPORT_SYMBOL_GPL(housekeeping_affine);
-bool housekeeping_test_cpu(int cpu)
+bool housekeeping_test_cpu(int cpu, enum hk_flags flags)
{
if (static_branch_unlikely(&housekeeping_overriden))
- return cpumask_test_cpu(cpu, housekeeping_mask);
-
+ if (housekeeping_flags & flags)
+ return cpumask_test_cpu(cpu, housekeeping_mask);
return true;
}
EXPORT_SYMBOL_GPL(housekeeping_test_cpu);
@@ -65,6 +67,8 @@ void __init housekeeping_init(void)
cpumask_andnot(housekeeping_mask,
cpu_possible_mask, tick_nohz_full_mask);
+ housekeeping_flags = HK_FLAG_TIMER | HK_FLAG_RCU | HK_FLAG_MISC;
+
static_branch_enable(&housekeeping_overriden);
/* We need at least one CPU to handle housekeeping work */
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 562652c..e9e2ebb 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -777,7 +777,8 @@ void __init lockup_detector_init(void)
if (tick_nohz_full_enabled())
pr_info("Disabling watchdog on nohz_full cores by default\n");
- cpumask_copy(&watchdog_cpumask, housekeeping_cpumask());
+ cpumask_copy(&watchdog_cpumask,
+ housekeeping_cpumask(HK_FLAG_TIMER));
if (!watchdog_nmi_probe())
nmi_watchdog_available = true;
next prev parent reply other threads:[~2017-10-27 12:09 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-27 2:42 [GIT PULL] Housekeeping subsystem v6 Frederic Weisbecker
2017-10-27 2:42 ` [PATCH 01/12] housekeeping: Move housekeeping related code to its own file Frederic Weisbecker
2017-10-27 12:01 ` [tip:sched/core] sched/isolation: " tip-bot for Frederic Weisbecker
2017-10-27 2:42 ` [PATCH 02/12] watchdog: Use housekeeping_cpumask() instead of ad-hoc version Frederic Weisbecker
2017-10-27 12:02 ` [tip:sched/core] sched/isolation, " tip-bot for Frederic Weisbecker
2017-10-27 2:42 ` [PATCH 03/12] housekeeping: Provide a dynamic off-case to housekeeping_any_cpu() Frederic Weisbecker
2017-10-27 12:02 ` [tip:sched/core] sched/isolation: " tip-bot for Frederic Weisbecker
2017-10-27 2:42 ` [PATCH 04/12] housekeeping: Make housekeeping cpumask private Frederic Weisbecker
2017-10-27 12:03 ` [tip:sched/core] sched/isolation: Make the " tip-bot for Frederic Weisbecker
2017-10-27 2:42 ` [PATCH 05/12] housekeeping: Use its own static key Frederic Weisbecker
2017-10-27 12:03 ` [tip:sched/core] sched/isolation: " tip-bot for Frederic Weisbecker
2017-10-27 2:42 ` [PATCH 06/12] housekeeping: Rename is_housekeeping_cpu to housekeeping_cpu Frederic Weisbecker
2017-10-27 12:03 ` [tip:sched/core] sched/isolation: Rename is_housekeeping_cpu() to housekeeping_cpu() tip-bot for Frederic Weisbecker
2017-10-27 2:42 ` [PATCH 07/12] housekeeping: Move it under its own config, independent from NO_HZ Frederic Weisbecker
2017-10-27 12:04 ` [tip:sched/core] sched/isolation: Split out new CONFIG_CPU_ISOLATION=y config from CONFIG_NO_HZ_FULL tip-bot for Frederic Weisbecker
2017-10-27 2:42 ` [PATCH 08/12] housekeeping: Introduce housekeeping flags Frederic Weisbecker
2017-10-27 12:04 ` tip-bot for Frederic Weisbecker [this message]
2017-10-27 2:42 ` [PATCH 09/12] housekeeping: Handle the nohz_full= parameter Frederic Weisbecker
2017-10-27 12:05 ` [tip:sched/core] sched/isolation: " tip-bot for Frederic Weisbecker
2017-10-27 2:42 ` [PATCH 10/12] housekeeping: Move isolcpus to housekeeping Frederic Weisbecker
2017-10-27 12:05 ` [tip:sched/core] sched/isolation: Move isolcpus= handling to the housekeeping code tip-bot for Frederic Weisbecker
2017-10-27 2:42 ` [PATCH 11/12] housekeeping: Add basic isolcpus flags Frederic Weisbecker
2017-10-27 12:05 ` [tip:sched/core] sched/isolation: " tip-bot for Frederic Weisbecker
2017-10-27 2:42 ` [PATCH 12/12] housekeeping: Document " Frederic Weisbecker
2017-10-27 12:06 ` [tip:sched/core] sched/isolation: Document the isolcpus= flags tip-bot for Frederic Weisbecker
2017-10-27 13:58 ` Peter Zijlstra
2017-10-27 14:36 ` Frederic Weisbecker
2017-10-27 17:06 ` Ingo Molnar
2017-10-27 17:33 ` Frederic Weisbecker
2017-10-27 18:21 ` Ingo Molnar
2017-10-27 18:39 ` Frederic Weisbecker
2017-10-27 19:04 ` Ingo Molnar
2017-10-27 14:38 ` Mike Galbraith
2017-10-30 15:48 ` Christopher Lameter
2017-10-30 16:11 ` Peter Zijlstra
2017-10-30 16:30 ` Christopher Lameter
2017-10-30 16:58 ` Peter Zijlstra
2017-10-30 16:56 ` Mike Galbraith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-de201559df872f83d0c08fb4effe3efd28e6cbc8@git.kernel.org \
--to=tipbot@zytor.com \
--cc=cl@linux.com \
--cc=cmetcalf@mellanox.com \
--cc=efault@gmx.de \
--cc=frederic@kernel.org \
--cc=hpa@zytor.com \
--cc=kernellwp@gmail.com \
--cc=lcapitulino@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).