Lines Matching +full:total +full:- +full:timeout

1 // SPDX-License-Identifier: GPL-2.0-only
5 * kernel/hung_task.c - kernel thread for detecting tasks stuck in D state
37 * Total number of tasks detected as hung since boot:
46 * the RCU grace period. So it needs to be upper-bound.
51 * Zero means infinite timeout - no checking done:
103 static bool task_is_hung(struct task_struct *t, unsigned long timeout) in task_is_hung() argument
105 unsigned long switch_count = t->nvcsw + t->nivcsw; in task_is_hung()
106 unsigned int state = READ_ONCE(t->__state); in task_is_hung()
109 * skip the TASK_KILLABLE tasks -- these can be killed in task_is_hung()
110 * skip the TASK_IDLE tasks -- those are genuinely idle in task_is_hung()
111 * skip the TASK_FROZEN task -- it reasonably stops scheduling by freezer in task_is_hung()
125 if (switch_count != t->last_switch_count) { in task_is_hung()
126 t->last_switch_count = switch_count; in task_is_hung()
127 t->last_switch_time = jiffies; in task_is_hung()
130 if (time_is_after_jiffies(t->last_switch_time + timeout * HZ)) in task_is_hung()
137 static void debug_show_blocker(struct task_struct *task, unsigned long timeout) in debug_show_blocker() argument
145 blocker = READ_ONCE(task->blocker); in debug_show_blocker()
178 task->comm, task->pid); in debug_show_blocker()
182 task->comm, task->pid); in debug_show_blocker()
186 pr_err("INFO: task %s:%d is blocked on an rw-semaphore, but the owner is not found.\n", in debug_show_blocker()
187 task->comm, task->pid); in debug_show_blocker()
201 task->comm, task->pid, t->comm, t->pid); in debug_show_blocker()
205 task->comm, task->pid, t->comm, t->pid); in debug_show_blocker()
209 pr_err("INFO: task %s:%d <%s> blocked on an rw-semaphore likely owned by task %s:%d <%s>\n", in debug_show_blocker()
210 task->comm, task->pid, rwsem_blocked_as, t->comm, in debug_show_blocker()
211 t->pid, rwsem_blocked_by); in debug_show_blocker()
215 if (!task_is_hung(t, timeout)) in debug_show_blocker()
221 static inline void debug_show_blocker(struct task_struct *task, unsigned long timeout) in debug_show_blocker() argument
226 static void check_hung_task(struct task_struct *t, unsigned long timeout, in check_hung_task() argument
231 if (!task_is_hung(t, timeout)) in check_hung_task()
235 * This counter tracks the total number of tasks detected as hung in check_hung_task()
240 total_hung_task = sysctl_hung_task_detect_count - prev_detect_count; in check_hung_task()
254 sysctl_hung_task_warnings--; in check_hung_task()
256 t->comm, t->pid, (jiffies - t->last_switch_time) / HZ); in check_hung_task()
258 print_tainted(), init_utsname()->release, in check_hung_task()
259 (int)strcspn(init_utsname()->version, " "), in check_hung_task()
260 init_utsname()->version); in check_hung_task()
261 if (t->flags & PF_POSTCOREDUMP) in check_hung_task()
266 debug_show_blocker(t, timeout); in check_hung_task()
303 static void check_hung_uninterruptible_tasks(unsigned long timeout) in check_hung_uninterruptible_tasks() argument
323 if (!max_count--) in check_hung_uninterruptible_tasks()
331 check_hung_task(t, timeout, prev_detect_count); in check_hung_uninterruptible_tasks()
336 if (!(sysctl_hung_task_detect_count - prev_detect_count)) in check_hung_uninterruptible_tasks()
353 unsigned long timeout) in hung_timeout_jiffies() argument
355 /* timeout of 0 will disable the watchdog */ in hung_timeout_jiffies()
356 return timeout ? last_checked - jiffies + timeout * HZ : in hung_timeout_jiffies()
362 * Process updating of timeout sysctl
504 unsigned long timeout = sysctl_hung_task_timeout_secs; in watchdog() local
509 interval = timeout; in watchdog()
510 interval = min_t(unsigned long, interval, timeout); in watchdog()
515 check_hung_uninterruptible_tasks(timeout); in watchdog()