aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/watchdog.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-01-11 21:53:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-11 21:53:13 -0500
commit0f8c7901039f8b1366ae364462743c8f4125822e (patch)
tree27cbd63383fdbce3ceca1ff2d248b3add78aa1ef /kernel/watchdog.c
parent3d116a66ed9df0271b8d267093b3bfde2be19b3a (diff)
parent6201171e3b2c02992e62448636631a0dfe4e9d20 (diff)
Merge branch 'for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
Pull workqueue update from Tejun Heo: "Workqueue changes for v4.5. One cleanup patch and three to improve the debuggability. Workqueue now has a stall detector which dumps workqueue state if any worker pool hasn't made forward progress over a certain amount of time (30s by default) and also triggers a warning if a workqueue which can be used in memory reclaim path tries to wait on something which can't be. These should make workqueue hangs a lot easier to debug." * 'for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: workqueue: simplify the apply_workqueue_attrs_locked() workqueue: implement lockup detector watchdog: introduce touch_softlockup_watchdog_sched() workqueue: warn if memory reclaim tries to flush !WQ_MEM_RECLAIM workqueue
Diffstat (limited to 'kernel/watchdog.c')
-rw-r--r--kernel/watchdog.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 84b5035cb6a5..b3ace6ebbba3 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -20,6 +20,7 @@
20#include <linux/smpboot.h> 20#include <linux/smpboot.h>
21#include <linux/sched/rt.h> 21#include <linux/sched/rt.h>
22#include <linux/tick.h> 22#include <linux/tick.h>
23#include <linux/workqueue.h>
23 24
24#include <asm/irq_regs.h> 25#include <asm/irq_regs.h>
25#include <linux/kvm_para.h> 26#include <linux/kvm_para.h>
@@ -225,7 +226,15 @@ static void __touch_watchdog(void)
225 __this_cpu_write(watchdog_touch_ts, get_timestamp()); 226 __this_cpu_write(watchdog_touch_ts, get_timestamp());
226} 227}
227 228
228void touch_softlockup_watchdog(void) 229/**
230 * touch_softlockup_watchdog_sched - touch watchdog on scheduler stalls
231 *
232 * Call when the scheduler may have stalled for legitimate reasons
233 * preventing the watchdog task from executing - e.g. the scheduler
234 * entering idle state. This should only be used for scheduler events.
235 * Use touch_softlockup_watchdog() for everything else.
236 */
237void touch_softlockup_watchdog_sched(void)
229{ 238{
230 /* 239 /*
231 * Preemption can be enabled. It doesn't matter which CPU's timestamp 240 * Preemption can be enabled. It doesn't matter which CPU's timestamp
@@ -233,6 +242,12 @@ void touch_softlockup_watchdog(void)
233 */ 242 */
234 raw_cpu_write(watchdog_touch_ts, 0); 243 raw_cpu_write(watchdog_touch_ts, 0);
235} 244}
245
246void touch_softlockup_watchdog(void)
247{
248 touch_softlockup_watchdog_sched();
249 wq_watchdog_touch(raw_smp_processor_id());
250}
236EXPORT_SYMBOL(touch_softlockup_watchdog); 251EXPORT_SYMBOL(touch_softlockup_watchdog);
237 252
238void touch_all_softlockup_watchdogs(void) 253void touch_all_softlockup_watchdogs(void)
@@ -246,6 +261,7 @@ void touch_all_softlockup_watchdogs(void)
246 */ 261 */
247 for_each_watchdog_cpu(cpu) 262 for_each_watchdog_cpu(cpu)
248 per_cpu(watchdog_touch_ts, cpu) = 0; 263 per_cpu(watchdog_touch_ts, cpu) = 0;
264 wq_watchdog_touch(-1);
249} 265}
250 266
251#ifdef CONFIG_HARDLOCKUP_DETECTOR 267#ifdef CONFIG_HARDLOCKUP_DETECTOR