Skip to content

Commit 7feeb9c

Browse files
KAGA-KOKOIngo Molnar
authored andcommitted
watchdog/sysctl: Clean up sysctl variable name space
Reflect that these variables are user interface related and remove the whitespace damage in the sysctl table while at it. 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.783210221@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 51d4052 commit 7feeb9c

File tree

3 files changed

+36
-37
lines changed

3 files changed

+36
-37
lines changed

include/linux/nmi.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ void lockup_detector_cleanup(void);
1717
bool is_hardlockup(void);
1818

1919
extern int watchdog_user_enabled;
20-
extern int nmi_watchdog_enabled;
21-
extern int soft_watchdog_enabled;
20+
extern int nmi_watchdog_user_enabled;
21+
extern int soft_watchdog_user_enabled;
2222
extern int watchdog_thresh;
2323
extern unsigned long watchdog_enabled;
2424

@@ -62,12 +62,12 @@ static inline void reset_hung_task_detector(void) { }
6262
* 'watchdog_enabled' variable. Each lockup detector has its dedicated bit -
6363
* bit 0 for the hard lockup detector and bit 1 for the soft lockup detector.
6464
*
65-
* 'watchdog_user_enabled', 'nmi_watchdog_enabled' and 'soft_watchdog_enabled'
66-
* are variables that are only used as an 'interface' between the parameters
67-
* in /proc/sys/kernel and the internal state bits in 'watchdog_enabled'. The
68-
* 'watchdog_thresh' variable is handled differently because its value is not
69-
* boolean, and the lockup detectors are 'suspended' while 'watchdog_thresh'
70-
* is equal zero.
65+
* 'watchdog_user_enabled', 'nmi_watchdog_user_enabled' and
66+
* 'soft_watchdog_user_enabled' are variables that are only used as an
67+
* 'interface' between the parameters in /proc/sys/kernel and the internal
68+
* state bits in 'watchdog_enabled'. The 'watchdog_thresh' variable is
69+
* handled differently because its value is not boolean, and the lockup
70+
* detectors are 'suspended' while 'watchdog_thresh' is equal zero.
7171
*/
7272
#define NMI_WATCHDOG_ENABLED_BIT 0
7373
#define SOFT_WATCHDOG_ENABLED_BIT 1

kernel/sysctl.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -871,9 +871,9 @@ static struct ctl_table kern_table[] = {
871871
#if defined(CONFIG_LOCKUP_DETECTOR)
872872
{
873873
.procname = "watchdog",
874-
.data = &watchdog_user_enabled,
875-
.maxlen = sizeof (int),
876-
.mode = 0644,
874+
.data = &watchdog_user_enabled,
875+
.maxlen = sizeof(int),
876+
.mode = 0644,
877877
.proc_handler = proc_watchdog,
878878
.extra1 = &zero,
879879
.extra2 = &one,
@@ -889,8 +889,8 @@ static struct ctl_table kern_table[] = {
889889
},
890890
{
891891
.procname = "nmi_watchdog",
892-
.data = &nmi_watchdog_enabled,
893-
.maxlen = sizeof (int),
892+
.data = &nmi_watchdog_user_enabled,
893+
.maxlen = sizeof(int),
894894
.mode = NMI_WATCHDOG_SYSCTL_PERM,
895895
.proc_handler = proc_nmi_watchdog,
896896
.extra1 = &zero,
@@ -906,9 +906,9 @@ static struct ctl_table kern_table[] = {
906906
#ifdef CONFIG_SOFTLOCKUP_DETECTOR
907907
{
908908
.procname = "soft_watchdog",
909-
.data = &soft_watchdog_enabled,
910-
.maxlen = sizeof (int),
911-
.mode = 0644,
909+
.data = &soft_watchdog_user_enabled,
910+
.maxlen = sizeof(int),
911+
.mode = 0644,
912912
.proc_handler = proc_soft_watchdog,
913913
.extra1 = &zero,
914914
.extra2 = &one,

kernel/watchdog.c

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,24 @@
3131

3232
static DEFINE_MUTEX(watchdog_mutex);
3333

34-
int __read_mostly nmi_watchdog_enabled;
35-
3634
#if defined(CONFIG_HARDLOCKUP_DETECTOR) || defined(CONFIG_HAVE_NMI_WATCHDOG)
3735
unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED |
3836
NMI_WATCHDOG_ENABLED;
3937
#else
4038
unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED;
4139
#endif
4240

41+
int __read_mostly nmi_watchdog_user_enabled;
42+
int __read_mostly soft_watchdog_user_enabled;
43+
int __read_mostly watchdog_user_enabled;
44+
int __read_mostly watchdog_thresh = 10;
45+
46+
struct cpumask watchdog_allowed_mask __read_mostly;
47+
static bool softlockup_threads_initialized __read_mostly;
48+
49+
struct cpumask watchdog_cpumask __read_mostly;
50+
unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask);
51+
4352
#ifdef CONFIG_HARDLOCKUP_DETECTOR
4453
/*
4554
* Should we panic when a soft-lockup or hard-lockup occurs:
@@ -85,12 +94,6 @@ __setup("hardlockup_all_cpu_backtrace=", hardlockup_all_cpu_backtrace_setup);
8594
# endif /* CONFIG_SMP */
8695
#endif /* CONFIG_HARDLOCKUP_DETECTOR */
8796

88-
int __read_mostly watchdog_user_enabled;
89-
int __read_mostly watchdog_thresh = 10;
90-
91-
struct cpumask watchdog_cpumask __read_mostly;
92-
unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask);
93-
9497
/*
9598
* These functions can be overridden if an architecture implements its
9699
* own hardlockup detector.
@@ -113,7 +116,7 @@ void __weak watchdog_nmi_disable(unsigned int cpu)
113116
* watchdog_nmi_reconfigure can be implemented to be notified after any
114117
* watchdog configuration change. The arch hardlockup watchdog should
115118
* respond to the following variables:
116-
* - nmi_watchdog_enabled
119+
* - watchdog_enabled
117120
* - watchdog_thresh
118121
* - watchdog_cpumask
119122
* - sysctl_hardlockup_all_cpu_backtrace
@@ -126,10 +129,6 @@ void __weak watchdog_nmi_reconfigure(void) { }
126129
/* Global variables, exported for sysctl */
127130
unsigned int __read_mostly softlockup_panic =
128131
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE;
129-
int __read_mostly soft_watchdog_enabled;
130-
131-
struct cpumask watchdog_allowed_mask __read_mostly;
132-
static bool softlockup_threads_initialized __read_mostly;
133132

134133
static u64 __read_mostly sample_period;
135134

@@ -606,14 +605,14 @@ static void proc_watchdog_update(void)
606605
/*
607606
* common function for watchdog, nmi_watchdog and soft_watchdog parameter
608607
*
609-
* caller | table->data points to | 'which' contains the flag(s)
610-
* -------------------|-----------------------|-----------------------------
611-
* proc_watchdog | watchdog_user_enabled | NMI_WATCHDOG_ENABLED or'ed
612-
* | | with SOFT_WATCHDOG_ENABLED
613-
* -------------------|-----------------------|-----------------------------
614-
* proc_nmi_watchdog | nmi_watchdog_enabled | NMI_WATCHDOG_ENABLED
615-
* -------------------|-----------------------|-----------------------------
616-
* proc_soft_watchdog | soft_watchdog_enabled | SOFT_WATCHDOG_ENABLED
608+
* caller | table->data points to | 'which'
609+
* -------------------|----------------------------|--------------------------
610+
* proc_watchdog | watchdog_user_enabled | NMI_WATCHDOG_ENABLED |
611+
* | | SOFT_WATCHDOG_ENABLED
612+
* -------------------|----------------------------|--------------------------
613+
* proc_nmi_watchdog | nmi_watchdog_user_enabled | NMI_WATCHDOG_ENABLED
614+
* -------------------|----------------------------|--------------------------
615+
* proc_soft_watchdog | soft_watchdog_user_enabled | SOFT_WATCHDOG_ENABLED
617616
*/
618617
static int proc_watchdog_common(int which, struct ctl_table *table, int write,
619618
void __user *buffer, size_t *lenp, loff_t *ppos)

0 commit comments

Comments
 (0)