Re: [PATCH v4 1/2] hung_task: Show the blocker task if the task is hung on mutex
From: Google
Date: Wed Jul 30 2025 - 04:52:01 EST
On Wed, 30 Jul 2025 16:59:22 +0900
Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> wrote:
> One thing that gives me a bit of "inconvenience" is that in certain
> cases this significantly increases the amount of stack traces to go
> through. A distilled real life example:
> - task T1 acquires lock L1, attempts to acquire L2
> - task T2 acquires lock L2, attempts to acquire L3
> - task T3 acquires lock L3, attempts to acquire L1
>
> So we'd now see:
> - a backtrace of T1, followed by a backtrace of T2 (owner of L2)
> - a backtrace of T2, followed by a backtrace of T3 (owner of L3)
> - a backtrace of T3, followed by a backtrace of T1 (owner of L1)
>
> Notice how each task is backtraced twice. I wonder if it's worth it
> to de-dup the backtraces. E.g. in
>
> task cat:115 is blocked on a mutex likely owned by task cat:114
>
> if we know that cat:114 is also blocked on a lock, then we probably
> can just say "is blocked on a mutex likely owned by task cat:114" and
> continue iterating through tasks. That "cat:114" will be backtraced
> individually later, as it's also blocked on a lock, owned by another
> task.
>
> Does this make any sense?
Hrm, OK. So what about dump the blocker task only if that task is
NOT blocked? (because if the task is blocked, it should be dumped
afterwards (or already))
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>