瀏覽代碼

softlockup: fix signedness

fix softlockup tunables signedness.

mark tunables read-mostly.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Ingo Molnar 17 年之前
父節點
當前提交
90739081ef
共有 3 個文件被更改,包括 15 次插入15 次删除
  1. 2 2
      include/linux/sched.h
  2. 5 5
      kernel/softlockup.c
  3. 8 8
      kernel/sysctl.c

+ 2 - 2
include/linux/sched.h

@@ -269,10 +269,10 @@ extern void softlockup_tick(void);
 extern void spawn_softlockup_task(void);
 extern void spawn_softlockup_task(void);
 extern void touch_softlockup_watchdog(void);
 extern void touch_softlockup_watchdog(void);
 extern void touch_all_softlockup_watchdogs(void);
 extern void touch_all_softlockup_watchdogs(void);
-extern int softlockup_thresh;
+extern unsigned long  softlockup_thresh;
 extern unsigned long sysctl_hung_task_check_count;
 extern unsigned long sysctl_hung_task_check_count;
 extern unsigned long sysctl_hung_task_timeout_secs;
 extern unsigned long sysctl_hung_task_timeout_secs;
-extern long sysctl_hung_task_warnings;
+extern unsigned long sysctl_hung_task_warnings;
 #else
 #else
 static inline void softlockup_tick(void)
 static inline void softlockup_tick(void)
 {
 {

+ 5 - 5
kernel/softlockup.c

@@ -24,8 +24,8 @@ static DEFINE_PER_CPU(unsigned long, touch_timestamp);
 static DEFINE_PER_CPU(unsigned long, print_timestamp);
 static DEFINE_PER_CPU(unsigned long, print_timestamp);
 static DEFINE_PER_CPU(struct task_struct *, watchdog_task);
 static DEFINE_PER_CPU(struct task_struct *, watchdog_task);
 
 
-static int did_panic;
-int softlockup_thresh = 60;
+static int __read_mostly did_panic;
+unsigned long __read_mostly softlockup_thresh = 60;
 
 
 static int
 static int
 softlock_panic(struct notifier_block *this, unsigned long event, void *ptr)
 softlock_panic(struct notifier_block *this, unsigned long event, void *ptr)
@@ -121,14 +121,14 @@ void softlockup_tick(void)
 /*
 /*
  * Have a reasonable limit on the number of tasks checked:
  * Have a reasonable limit on the number of tasks checked:
  */
  */
-unsigned long sysctl_hung_task_check_count = 1024;
+unsigned long __read_mostly sysctl_hung_task_check_count = 1024;
 
 
 /*
 /*
  * Zero means infinite timeout - no checking done:
  * Zero means infinite timeout - no checking done:
  */
  */
-unsigned long sysctl_hung_task_timeout_secs = 120;
+unsigned long __read_mostly sysctl_hung_task_timeout_secs = 120;
 
 
-long sysctl_hung_task_warnings = 10;
+unsigned long __read_mostly sysctl_hung_task_warnings = 10;
 
 
 /*
 /*
  * Only do the hung-tasks check on one CPU:
  * Only do the hung-tasks check on one CPU:

+ 8 - 8
kernel/sysctl.c

@@ -772,9 +772,9 @@ static struct ctl_table kern_table[] = {
 		.ctl_name	= CTL_UNNUMBERED,
 		.ctl_name	= CTL_UNNUMBERED,
 		.procname	= "softlockup_thresh",
 		.procname	= "softlockup_thresh",
 		.data		= &softlockup_thresh,
 		.data		= &softlockup_thresh,
-		.maxlen		= sizeof(int),
+		.maxlen		= sizeof(unsigned long),
 		.mode		= 0644,
 		.mode		= 0644,
-		.proc_handler	= &proc_dointvec_minmax,
+		.proc_handler	= &proc_doulongvec_minmax,
 		.strategy	= &sysctl_intvec,
 		.strategy	= &sysctl_intvec,
 		.extra1		= &one,
 		.extra1		= &one,
 		.extra2		= &sixty,
 		.extra2		= &sixty,
@@ -783,27 +783,27 @@ static struct ctl_table kern_table[] = {
 		.ctl_name	= CTL_UNNUMBERED,
 		.ctl_name	= CTL_UNNUMBERED,
 		.procname	= "hung_task_check_count",
 		.procname	= "hung_task_check_count",
 		.data		= &sysctl_hung_task_check_count,
 		.data		= &sysctl_hung_task_check_count,
-		.maxlen		= sizeof(int),
+		.maxlen		= sizeof(unsigned long),
 		.mode		= 0644,
 		.mode		= 0644,
-		.proc_handler	= &proc_dointvec_minmax,
+		.proc_handler	= &proc_doulongvec_minmax,
 		.strategy	= &sysctl_intvec,
 		.strategy	= &sysctl_intvec,
 	},
 	},
 	{
 	{
 		.ctl_name	= CTL_UNNUMBERED,
 		.ctl_name	= CTL_UNNUMBERED,
 		.procname	= "hung_task_timeout_secs",
 		.procname	= "hung_task_timeout_secs",
 		.data		= &sysctl_hung_task_timeout_secs,
 		.data		= &sysctl_hung_task_timeout_secs,
-		.maxlen		= sizeof(int),
+		.maxlen		= sizeof(unsigned long),
 		.mode		= 0644,
 		.mode		= 0644,
-		.proc_handler	= &proc_dointvec_minmax,
+		.proc_handler	= &proc_doulongvec_minmax,
 		.strategy	= &sysctl_intvec,
 		.strategy	= &sysctl_intvec,
 	},
 	},
 	{
 	{
 		.ctl_name	= CTL_UNNUMBERED,
 		.ctl_name	= CTL_UNNUMBERED,
 		.procname	= "hung_task_warnings",
 		.procname	= "hung_task_warnings",
 		.data		= &sysctl_hung_task_warnings,
 		.data		= &sysctl_hung_task_warnings,
-		.maxlen		= sizeof(int),
+		.maxlen		= sizeof(unsigned long),
 		.mode		= 0644,
 		.mode		= 0644,
-		.proc_handler	= &proc_dointvec_minmax,
+		.proc_handler	= &proc_doulongvec_minmax,
 		.strategy	= &sysctl_intvec,
 		.strategy	= &sysctl_intvec,
 	},
 	},
 #endif
 #endif