Re: [PATCH v4 1/2] hung_task: Show the blocker task if the task is hung on mutex

From: Sergey Senozhatsky
Date: Tue Feb 25 2025 - 23:38:35 EST


On (25/02/25 16:02), Masami Hiramatsu (Google) wrote:
> The "hung_task" shows a long-time uninterruptible slept task, but most
> often, it's blocked on a mutex acquired by another task. Without
> dumping such a task, investigating the root cause of the hung task
> problem is very difficult.
>
> This introduce task_struct::blocker_mutex to point the mutex lock
> which this task is waiting for. Since the mutex has "owner"
> information, we can find the owner task and dump it with hung tasks.
>
> Note: the owner can be changed while dumping the owner task, so
> this is "likely" the owner of the mutex.

I assume another possibility can be that the owner is still around,
let's say a kworker that simply forgot to mutex_unlock(), so we'll
get its backtrace but it can be misleading, because kworker in
question might be doing something completely unrelated. But this
is still better than nothing.

FWIW
Reviewed-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>