mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
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 <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.218075991@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
368a7e2ce8
commit
05ba3de74a
1 changed files with 21 additions and 19 deletions
|
@ -792,10 +792,29 @@ static int watchdog_update_cpus(void)
|
||||||
if (IS_ENABLED(CONFIG_SOFTLOCKUP_DETECTOR)) {
|
if (IS_ENABLED(CONFIG_SOFTLOCKUP_DETECTOR)) {
|
||||||
return smpboot_update_cpumask_percpu_thread(&watchdog_threads,
|
return smpboot_update_cpumask_percpu_thread(&watchdog_threads,
|
||||||
&watchdog_cpumask);
|
&watchdog_cpumask);
|
||||||
|
__lockup_detector_cleanup();
|
||||||
}
|
}
|
||||||
return 0;
|
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
|
* 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
|
* 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);
|
mutex_lock(&watchdog_mutex);
|
||||||
|
|
||||||
err = proc_do_large_bitmap(table, write, buffer, lenp, ppos);
|
err = proc_do_large_bitmap(table, write, buffer, lenp, ppos);
|
||||||
if (!err && write) {
|
if (!err && write)
|
||||||
/* Remove impossible cpus to keep sysctl output cleaner. */
|
proc_watchdog_cpumask_update();
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_unlock(&watchdog_mutex);
|
mutex_unlock(&watchdog_mutex);
|
||||||
cpu_hotplug_enable();
|
cpu_hotplug_enable();
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SYSCTL */
|
#endif /* CONFIG_SYSCTL */
|
||||||
|
|
||||||
void __init lockup_detector_init(void)
|
void __init lockup_detector_init(void)
|
||||||
|
|
Loading…
Add table
Reference in a new issue