smpboot/threads, watchdog/core: Avoid runtime allocation

smpboot_update_cpumask_threads_percpu() allocates a temporary cpumask at
runtime. This is suboptimal because the call site needs more code size for
proper error handling than a statically allocated temporary mask requires
data size.

Add static temporary cpumask. The function is globaly serialized, so no
further protection required.

Remove the half baken error handling in the watchdog code and get rid of
the export as there are no in tree modular users of that function.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Don Zickus <dzickus@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Link: http://lkml.kernel.org/r/20170912194147.297288838@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
此提交包含在:
Thomas Gleixner
2017-09-12 21:37:09 +02:00
提交者 Ingo Molnar
父節點 05ba3de74a
當前提交 0d85923c7a
共有 3 個檔案被更改,包括 14 行新增33 行删除

查看文件

@@ -787,31 +787,20 @@ out:
return err;
}
static int watchdog_update_cpus(void)
static void watchdog_update_cpus(void)
{
if (IS_ENABLED(CONFIG_SOFTLOCKUP_DETECTOR)) {
return smpboot_update_cpumask_percpu_thread(&watchdog_threads,
&watchdog_cpumask);
if (IS_ENABLED(CONFIG_SOFTLOCKUP_DETECTOR) && watchdog_running) {
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_update_cpus();
watchdog_nmi_reconfigure();
}