summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2013-10-11 21:39:26 -0300
committerGleb Natapov <gleb@redhat.com>2013-11-06 09:49:02 +0200
commit8b414521bc5375ae8ba18c083af95d44b8da0d04 (patch)
treedd45ba45e6c397081c838b4dd80e42bc3752ad4f
parentd63285e94af3ade4fa8b10b0d9a22bcf72baf2f9 (diff)
downloadlinux-8b414521bc5375ae8ba18c083af95d44b8da0d04.tar.bz2
hung_task: add method to reset detector
In certain occasions it is possible for a hung task detector positive to be false: continuation from a paused VM, for example. Add a method to reset detection, similar as is done with other kernel watchdogs. Acked-by: Don Zickus <dzickus@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
-rw-r--r--arch/x86/kernel/pvclock.c1
-rw-r--r--include/linux/sched.h8
-rw-r--r--kernel/hung_task.c11
3 files changed, 20 insertions, 0 deletions
diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
index 6279928c0a71..2f355d229a58 100644
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -48,6 +48,7 @@ void pvclock_touch_watchdogs(void)
touch_softlockup_watchdog_sync();
clocksource_touch_watchdog();
rcu_cpu_stall_reset();
+ reset_hung_task_detector();
}
static atomic64_t last_value = ATOMIC64_INIT(0);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6682da36b293..7bb4b4a2a101 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -285,6 +285,14 @@ static inline void lockup_detector_init(void)
}
#endif
+#ifdef CONFIG_DETECT_HUNG_TASK
+void reset_hung_task_detector(void);
+#else
+static inline void reset_hung_task_detector(void)
+{
+}
+#endif
+
/* Attach to any functions which should be ignored in wchan output. */
#define __sched __attribute__((__section__(".sched.text")))
diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index 3e97fb126e6b..dfdf51534b3e 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -203,6 +203,14 @@ int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
return ret;
}
+static atomic_t reset_hung_task = ATOMIC_INIT(0);
+
+void reset_hung_task_detector(void)
+{
+ atomic_set(&reset_hung_task, 1);
+}
+EXPORT_SYMBOL_GPL(reset_hung_task_detector);
+
/*
* kthread which checks for tasks stuck in D state
*/
@@ -216,6 +224,9 @@ static int watchdog(void *dummy)
while (schedule_timeout_interruptible(timeout_jiffies(timeout)))
timeout = sysctl_hung_task_timeout_secs;
+ if (atomic_xchg(&reset_hung_task, 0))
+ continue;
+
check_hung_uninterruptible_tasks(timeout);
}