Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hung_task: check the value of "sysctl_hung_task_timeout_sec"

As sysctl_hung_task_timeout_sec is unsigned long, when this value is
larger then LONG_MAX/HZ, the function schedule_timeout_interruptible in
watchdog will return immediately without sleep and with print :

schedule_timeout: wrong timeout value ffffffffffffff83

and then the funtion watchdog will call schedule_timeout_interruptible
again and again. The screen will be filled with

"schedule_timeout: wrong timeout value ffffffffffffff83"

This patch does some check and correction in sysctl, to let the function
schedule_timeout_interruptible allways get the valid parameter.

Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Tested-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Cc: <stable@vger.kernel.org> [3.4+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Liu Hua and committed by
Linus Torvalds
80df2847 2aaf308b

+7
+1
Documentation/sysctl/kernel.txt
··· 317 317 This file shows up if CONFIG_DETECT_HUNG_TASK is enabled. 318 318 319 319 0: means infinite timeout - no checking done. 320 + Possible values to set are in range {0..LONG_MAX/HZ}. 320 321 321 322 ============================================================== 322 323
+6
kernel/sysctl.c
··· 141 141 static int ngroups_max = NGROUPS_MAX; 142 142 static const int cap_last_cap = CAP_LAST_CAP; 143 143 144 + /*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */ 145 + #ifdef CONFIG_DETECT_HUNG_TASK 146 + static unsigned long hung_task_timeout_max = (LONG_MAX/HZ); 147 + #endif 148 + 144 149 #ifdef CONFIG_INOTIFY_USER 145 150 #include <linux/inotify.h> 146 151 #endif ··· 990 985 .maxlen = sizeof(unsigned long), 991 986 .mode = 0644, 992 987 .proc_handler = proc_dohung_task_timeout_secs, 988 + .extra2 = &hung_task_timeout_max, 993 989 }, 994 990 { 995 991 .procname = "hung_task_warnings",