diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2017-09-12 15:37:12 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2017-09-14 05:41:06 -0400 |
| commit | e8b62b2dd14f8f2427856ba24cb7db922bda9bfd (patch) | |
| tree | f08f6ca005a6342b6ca1051a418c1a969be72922 /kernel | |
| parent | d57108d4f6791291e89d980e7f7a3566c32ab188 (diff) | |
watchdog/core: Further simplify sysctl handling
Use a single function to update sysctl changes. This is not a high
frequency user space interface and it's root only.
Preparatory patch to cleanup the sysctl variable handling.
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.549114957@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/watchdog.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 762d3ed82a08..ca8747221e87 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
| @@ -507,11 +507,8 @@ static void softlockup_park_all_threads(void) | |||
| 507 | softlockup_update_smpboot_threads(); | 507 | softlockup_update_smpboot_threads(); |
| 508 | } | 508 | } |
| 509 | 509 | ||
| 510 | /* | 510 | /* Unpark enabled threads */ |
| 511 | * Park threads which are not longer enabled and unpark threads which have | 511 | static void softlockup_unpark_threads(void) |
| 512 | * been newly enabled. | ||
| 513 | */ | ||
| 514 | static void softlockup_update_threads(void) | ||
| 515 | { | 512 | { |
| 516 | cpumask_copy(&watchdog_allowed_mask, &watchdog_cpumask); | 513 | cpumask_copy(&watchdog_allowed_mask, &watchdog_cpumask); |
| 517 | softlockup_update_smpboot_threads(); | 514 | softlockup_update_smpboot_threads(); |
| @@ -522,7 +519,7 @@ static void softlockup_reconfigure_threads(bool enabled) | |||
| 522 | softlockup_park_all_threads(); | 519 | softlockup_park_all_threads(); |
| 523 | set_sample_period(); | 520 | set_sample_period(); |
| 524 | if (enabled) | 521 | if (enabled) |
| 525 | softlockup_update_threads(); | 522 | softlockup_unpark_threads(); |
| 526 | } | 523 | } |
| 527 | 524 | ||
| 528 | /* | 525 | /* |
| @@ -563,7 +560,6 @@ static inline void watchdog_unpark_threads(void) { } | |||
| 563 | static inline int watchdog_enable_all_cpus(void) { return 0; } | 560 | static inline int watchdog_enable_all_cpus(void) { return 0; } |
| 564 | static inline void watchdog_disable_all_cpus(void) { } | 561 | static inline void watchdog_disable_all_cpus(void) { } |
| 565 | static inline void softlockup_init_threads(void) { } | 562 | static inline void softlockup_init_threads(void) { } |
| 566 | static inline void softlockup_update_threads(void) { } | ||
| 567 | static inline void softlockup_reconfigure_threads(bool enabled) { } | 563 | static inline void softlockup_reconfigure_threads(bool enabled) { } |
| 568 | #endif /* !CONFIG_SOFTLOCKUP_DETECTOR */ | 564 | #endif /* !CONFIG_SOFTLOCKUP_DETECTOR */ |
| 569 | 565 | ||
| @@ -598,11 +594,11 @@ void lockup_detector_soft_poweroff(void) | |||
| 598 | 594 | ||
| 599 | #ifdef CONFIG_SYSCTL | 595 | #ifdef CONFIG_SYSCTL |
| 600 | 596 | ||
| 601 | /* | 597 | /* Propagate any changes to the watchdog threads */ |
| 602 | * Update the run state of the lockup detectors. | ||
| 603 | */ | ||
| 604 | static void proc_watchdog_update(void) | 598 | static void proc_watchdog_update(void) |
| 605 | { | 599 | { |
| 600 | /* Remove impossible cpus to keep sysctl output clean. */ | ||
| 601 | cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask); | ||
| 606 | softlockup_reconfigure_threads(watchdog_enabled && watchdog_thresh); | 602 | softlockup_reconfigure_threads(watchdog_enabled && watchdog_thresh); |
| 607 | watchdog_nmi_reconfigure(); | 603 | watchdog_nmi_reconfigure(); |
| 608 | } | 604 | } |
| @@ -721,15 +717,6 @@ int proc_watchdog_thresh(struct ctl_table *table, int write, | |||
| 721 | return err; | 717 | return err; |
| 722 | } | 718 | } |
| 723 | 719 | ||
| 724 | static void proc_watchdog_cpumask_update(void) | ||
| 725 | { | ||
| 726 | /* Remove impossible cpus to keep sysctl output clean. */ | ||
| 727 | cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask); | ||
| 728 | |||
| 729 | softlockup_update_threads(); | ||
| 730 | watchdog_nmi_reconfigure(); | ||
| 731 | } | ||
| 732 | |||
| 733 | /* | 720 | /* |
| 734 | * The cpumask is the mask of possible cpus that the watchdog can run | 721 | * The cpumask is the mask of possible cpus that the watchdog can run |
| 735 | * on, not the mask of cpus it is actually running on. This allows the | 722 | * on, not the mask of cpus it is actually running on. This allows the |
| @@ -746,7 +733,7 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write, | |||
| 746 | 733 | ||
| 747 | err = proc_do_large_bitmap(table, write, buffer, lenp, ppos); | 734 | err = proc_do_large_bitmap(table, write, buffer, lenp, ppos); |
| 748 | if (!err && write) | 735 | if (!err && write) |
| 749 | proc_watchdog_cpumask_update(); | 736 | proc_watchdog_update(); |
| 750 | 737 | ||
| 751 | mutex_unlock(&watchdog_mutex); | 738 | mutex_unlock(&watchdog_mutex); |
| 752 | cpu_hotplug_enable(); | 739 | cpu_hotplug_enable(); |
