Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755162AbcKQSgl (ORCPT ); Thu, 17 Nov 2016 13:36:41 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:49689 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755028AbcKQSgd (ORCPT ); Thu, 17 Nov 2016 13:36:33 -0500 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: rt@linuxtronix.de, Sebastian Andrzej Siewior Subject: [PATCH 13/20] sched/nohz: Convert to hotplug state machine Date: Thu, 17 Nov 2016 19:35:34 +0100 Message-Id: <20161117183541.8588-14-bigeasy@linutronix.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161117183541.8588-1-bigeasy@linutronix.de> References: <20161117183541.8588-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2087 Lines: 68 Install the callbacks via the state machine. Signed-off-by: Sebastian Andrzej Siewior --- kernel/time/tick-sched.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 3bcb61b52f6c..420da0749792 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -390,24 +390,16 @@ static int __init tick_nohz_full_setup(char *str) } __setup("nohz_full=3D", tick_nohz_full_setup); =20 -static int tick_nohz_cpu_down_callback(struct notifier_block *nfb, - unsigned long action, - void *hcpu) +static int tick_nohz_cpu_down(unsigned int cpu) { - unsigned int cpu =3D (unsigned long)hcpu; - - switch (action & ~CPU_TASKS_FROZEN) { - case CPU_DOWN_PREPARE: - /* - * The boot CPU handles housekeeping duty (unbound timers, - * workqueues, timekeeping, ...) on behalf of full dynticks - * CPUs. It must remain online when nohz full is enabled. - */ - if (tick_nohz_full_running && tick_do_timer_cpu =3D=3D cpu) - return NOTIFY_BAD; - break; - } - return NOTIFY_OK; + /* + * The boot CPU handles housekeeping duty (unbound timers, + * workqueues, timekeeping, ...) on behalf of full dynticks + * CPUs. It must remain online when nohz full is enabled. + */ + if (tick_nohz_full_running && tick_do_timer_cpu =3D=3D cpu) + return -EINVAL; + return 0; } =20 static int tick_nohz_init_all(void) @@ -428,7 +420,7 @@ static int tick_nohz_init_all(void) =20 void __init tick_nohz_init(void) { - int cpu; + int cpu, ret; =20 if (!tick_nohz_full_running) { if (tick_nohz_init_all() < 0) @@ -469,7 +461,10 @@ void __init tick_nohz_init(void) for_each_cpu(cpu, tick_nohz_full_mask) context_tracking_cpu_set(cpu); =20 - cpu_notifier(tick_nohz_cpu_down_callback, 0); + ret =3D cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, + "kernel/nohz:predown", NULL, + tick_nohz_cpu_down); + WARN_ON(ret < 0); pr_info("NO_HZ: Full dynticks CPUs: %*pbl.\n", cpumask_pr_args(tick_nohz_full_mask)); =20 --=20 2.10.2