Skip to content

Commit

Permalink
hung_task: add method to reset detector
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
Signed-off-by: Gleb Natapov <[email protected]>
  • Loading branch information
matosatti authored and Gleb Natapov committed Nov 6, 2013
1 parent d63285e commit 8b41452
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/x86/kernel/pvclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")))

Expand Down
11 changes: 11 additions & 0 deletions kernel/hung_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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);
}

Expand Down

0 comments on commit 8b41452

Please sign in to comment.