From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751902AbdJXO5f (ORCPT ); Tue, 24 Oct 2017 10:57:35 -0400 Received: from terminus.zytor.com ([65.50.211.136]:49825 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751398AbdJXO5a (ORCPT ); Tue, 24 Oct 2017 10:57:30 -0400 Date: Tue, 24 Oct 2017 07:52:35 -0700 From: tip-bot for Frederic Weisbecker Message-ID: Cc: lcapitulino@redhat.com, cl@linux.com, hpa@zytor.com, paulmck@linux.vnet.ibm.com, cmetcalf@mellanox.com, frederic@kernel.org, mingo@kernel.org, torvalds@linux-foundation.org, tglx@linutronix.de, kernellwp@gmail.com, peterz@infradead.org, efault@gmx.de, linux-kernel@vger.kernel.org, riel@redhat.com Reply-To: torvalds@linux-foundation.org, tglx@linutronix.de, kernellwp@gmail.com, mingo@kernel.org, riel@redhat.com, peterz@infradead.org, efault@gmx.de, linux-kernel@vger.kernel.org, lcapitulino@redhat.com, cl@linux.com, frederic@kernel.org, hpa@zytor.com, paulmck@linux.vnet.ibm.com, cmetcalf@mellanox.com In-Reply-To: <1508850421-10058-10-git-send-email-frederic@kernel.org> References: <1508850421-10058-10-git-send-email-frederic@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] housekeeping: Handle the nohz_full= parameter Git-Commit-ID: 32bf454c0e7568e0fdea85434d573daf1bbaff4a X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 32bf454c0e7568e0fdea85434d573daf1bbaff4a Gitweb: https://git.kernel.org/tip/32bf454c0e7568e0fdea85434d573daf1bbaff4a Author: Frederic Weisbecker AuthorDate: Tue, 24 Oct 2017 15:06:58 +0200 Committer: Ingo Molnar CommitDate: Tue, 24 Oct 2017 15:20:15 +0200 housekeeping: Handle the nohz_full= parameter We want to centralize the isolation management from the housekeeping subsystem. Therefore we need to handle the nohz_full= parameter from there. Since nohz_full= so far has involved unbound timers, watchdog, RCU and tilegx NAPI isolation, we keep that default behaviour. nohz_full= is deemed to be deprecated in the future. We want to control the isolation features from the isolcpus= parameter. Signed-off-by: Frederic Weisbecker Cc: Chris Metcalf Cc: Christoph Lameter Cc: Linus Torvalds Cc: Luiz Capitulino Cc: Mike Galbraith Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Cc: Wanpeng Li Link: http://lkml.kernel.org/r/1508850421-10058-10-git-send-email-frederic@kernel.org Signed-off-by: Ingo Molnar --- include/linux/housekeeping.h | 1 + include/linux/tick.h | 2 ++ init/Kconfig | 1 - kernel/housekeeping.c | 42 ++++++++++++++++++++++++++++++------------ kernel/time/tick-sched.c | 13 +++---------- 5 files changed, 36 insertions(+), 23 deletions(-) diff --git a/include/linux/housekeeping.h b/include/linux/housekeeping.h index b1a6254..35fb197 100644 --- a/include/linux/housekeeping.h +++ b/include/linux/housekeeping.h @@ -10,6 +10,7 @@ enum hk_flags { HK_FLAG_RCU = (1 << 1), HK_FLAG_MISC = (1 << 2), HK_FLAG_SCHED = (1 << 3), + HK_FLAG_TICK = (1 << 4), }; #ifdef CONFIG_CPU_ISOLATION diff --git a/include/linux/tick.h b/include/linux/tick.h index 68afc09..e2a163a 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -228,6 +228,7 @@ static inline void tick_dep_clear_signal(struct signal_struct *signal, extern void tick_nohz_full_kick_cpu(int cpu); extern void __tick_nohz_task_switch(void); +extern void __init tick_nohz_full_setup(cpumask_var_t cpumask); #else static inline bool tick_nohz_full_enabled(void) { return false; } static inline bool tick_nohz_full_cpu(int cpu) { return false; } @@ -248,6 +249,7 @@ static inline void tick_dep_clear_signal(struct signal_struct *signal, static inline void tick_nohz_full_kick_cpu(int cpu) { } static inline void __tick_nohz_task_switch(void) { } +static inline void tick_nohz_full_setup(cpumask_var_t cpumask) { } #endif static inline void tick_nohz_task_switch(void) diff --git a/init/Kconfig b/init/Kconfig index 6f52e6f..f8564df 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -474,7 +474,6 @@ endmenu # "CPU/Task time and stats accounting" config CPU_ISOLATION bool "CPU isolation" - depends on NO_HZ_FULL help Make sure that CPUs running critical tasks are not disturbed by any source of "noise" such as unbound workqueues, timers, kthreads... diff --git a/kernel/housekeeping.c b/kernel/housekeeping.c index 2cf52ee..8fb8d6b 100644 --- a/kernel/housekeeping.c +++ b/kernel/housekeeping.c @@ -50,23 +50,41 @@ bool housekeeping_test_cpu(int cpu, enum hk_flags flags) void __init housekeeping_init(void) { - if (!tick_nohz_full_enabled()) + if (!housekeeping_flags) return; - if (!alloc_cpumask_var(&housekeeping_mask, GFP_KERNEL)) { - WARN(1, "NO_HZ: Can't allocate not-full dynticks cpumask\n"); - cpumask_clear(tick_nohz_full_mask); - tick_nohz_full_running = false; - return; + static_branch_enable(&housekeeping_overriden); + + /* We need at least one CPU to handle housekeeping work */ + WARN_ON_ONCE(cpumask_empty(housekeeping_mask)); +} + +#ifdef CONFIG_NO_HZ_FULL +static int __init housekeeping_nohz_full_setup(char *str) +{ + cpumask_var_t non_housekeeping_mask; + + alloc_bootmem_cpumask_var(&non_housekeeping_mask); + if (cpulist_parse(str, non_housekeeping_mask) < 0) { + pr_warn("Housekeeping: Incorrect nohz_full cpumask\n"); + free_bootmem_cpumask_var(non_housekeeping_mask); + return 0; } - cpumask_andnot(housekeeping_mask, - cpu_possible_mask, tick_nohz_full_mask); + alloc_bootmem_cpumask_var(&housekeeping_mask); + cpumask_andnot(housekeeping_mask, cpu_possible_mask, non_housekeeping_mask); - housekeeping_flags = HK_FLAG_TIMER | HK_FLAG_RCU | HK_FLAG_MISC; + if (cpumask_empty(housekeeping_mask)) + cpumask_set_cpu(smp_processor_id(), housekeeping_mask); - static_branch_enable(&housekeeping_overriden); + housekeeping_flags = HK_FLAG_TICK | HK_FLAG_TIMER | + HK_FLAG_RCU | HK_FLAG_MISC; - /* We need at least one CPU to handle housekeeping work */ - WARN_ON_ONCE(cpumask_empty(housekeeping_mask)); + tick_nohz_full_setup(non_housekeeping_mask); + + free_bootmem_cpumask_var(non_housekeeping_mask); + + return 1; } +__setup("nohz_full=", housekeeping_nohz_full_setup); +#endif diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 27d7d52..69f3dbe 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -385,20 +385,13 @@ out: local_irq_restore(flags); } -/* Parse the boot-time nohz CPU list from the kernel parameters. */ -static int __init tick_nohz_full_setup(char *str) +/* Get the boot-time nohz CPU list from the kernel parameters. */ +void __init tick_nohz_full_setup(cpumask_var_t cpumask) { alloc_bootmem_cpumask_var(&tick_nohz_full_mask); - if (cpulist_parse(str, tick_nohz_full_mask) < 0) { - pr_warn("NO_HZ: Incorrect nohz_full cpumask\n"); - free_bootmem_cpumask_var(tick_nohz_full_mask); - return 1; - } + cpumask_copy(tick_nohz_full_mask, cpumask); tick_nohz_full_running = true; - - return 1; } -__setup("nohz_full=", tick_nohz_full_setup); static int tick_nohz_cpu_down(unsigned int cpu) {