From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752106AbdINKuq (ORCPT ); Thu, 14 Sep 2017 06:50:46 -0400 Received: from terminus.zytor.com ([65.50.211.136]:59169 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751500AbdINKup (ORCPT ); Thu, 14 Sep 2017 06:50:45 -0400 Date: Thu, 14 Sep 2017 03:45:05 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: peterz@infradead.org, cmetcalf@mellanox.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, bp@alien8.de, bigeasy@linutronix.de, mingo@kernel.org, hpa@zytor.com, dzickus@redhat.com, akpm@linux-foundation.org, npiggin@gmail.com, uobergfe@redhat.com, torvalds@linux-foundation.org Reply-To: torvalds@linux-foundation.org, uobergfe@redhat.com, npiggin@gmail.com, akpm@linux-foundation.org, dzickus@redhat.com, hpa@zytor.com, bigeasy@linutronix.de, mingo@kernel.org, bp@alien8.de, tglx@linutronix.de, linux-kernel@vger.kernel.org, cmetcalf@mellanox.com, peterz@infradead.org In-Reply-To: <20170912194147.218075991@linutronix.de> References: <20170912194147.218075991@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:core/urgent] watchdog/core: Split out cpumask write function Git-Commit-ID: 05ba3de74a3f499dcaa37b186220aaf174c95a4b 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: 05ba3de74a3f499dcaa37b186220aaf174c95a4b Gitweb: http://git.kernel.org/tip/05ba3de74a3f499dcaa37b186220aaf174c95a4b Author: Thomas Gleixner AuthorDate: Tue, 12 Sep 2017 21:37:08 +0200 Committer: Ingo Molnar CommitDate: Thu, 14 Sep 2017 11:41:06 +0200 watchdog/core: Split out cpumask write function Split the write part of the cpumask proc handler out into a separate helper to avoid deep indentation. This also reduces the patch complexity in the following cleanups. Signed-off-by: Thomas Gleixner Reviewed-by: Don Zickus Cc: Andrew Morton Cc: Borislav Petkov Cc: Chris Metcalf Cc: Linus Torvalds Cc: Nicholas Piggin Cc: Peter Zijlstra Cc: Sebastian Siewior Cc: Ulrich Obergfell Link: http://lkml.kernel.org/r/20170912194147.218075991@linutronix.de Signed-off-by: Ingo Molnar --- kernel/watchdog.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index a9bdfde..cedf45a 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -792,10 +792,29 @@ static int watchdog_update_cpus(void) if (IS_ENABLED(CONFIG_SOFTLOCKUP_DETECTOR)) { return smpboot_update_cpumask_percpu_thread(&watchdog_threads, &watchdog_cpumask); + __lockup_detector_cleanup(); } return 0; } +static void proc_watchdog_cpumask_update(void) +{ + /* Remove impossible cpus to keep sysctl output clean. */ + cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask); + + if (watchdog_running) { + /* + * Failure would be due to being unable to allocate a + * temporary cpumask, so we are likely not in a position to + * do much else to make things better. + */ + if (watchdog_update_cpus() != 0) + pr_err("cpumask update failed\n"); + } + + watchdog_nmi_reconfigure(); +} + /* * The cpumask is the mask of possible cpus that the watchdog can run * on, not the mask of cpus it is actually running on. This allows the @@ -811,30 +830,13 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write, mutex_lock(&watchdog_mutex); err = proc_do_large_bitmap(table, write, buffer, lenp, ppos); - if (!err && write) { - /* Remove impossible cpus to keep sysctl output cleaner. */ - cpumask_and(&watchdog_cpumask, &watchdog_cpumask, - cpu_possible_mask); - - if (watchdog_running) { - /* - * Failure would be due to being unable to allocate - * a temporary cpumask, so we are likely not in a - * position to do much else to make things better. - */ - if (watchdog_update_cpus() != 0) - pr_err("cpumask update failed\n"); - } - - watchdog_nmi_reconfigure(); - __lockup_detector_cleanup(); - } + if (!err && write) + proc_watchdog_cpumask_update(); mutex_unlock(&watchdog_mutex); cpu_hotplug_enable(); return err; } - #endif /* CONFIG_SYSCTL */ void __init lockup_detector_init(void)