Re: [PATCH v4 0/3] hung_task: extend blocking task stacktrace dump to semaphore
From: Andrew Morton
Date: Mon Apr 07 2025 - 16:08:40 EST
On Thu, 20 Mar 2025 14:49:20 +0800 Lance Yang <ioworker0@xxxxxxxxx> wrote:
> Inspired by mutex blocker tracking[1], this patch series extend the
> feature to not only dump the blocker task holding a mutex but also to
> support semaphores. Unlike mutexes, semaphores lack explicit ownership
> tracking, making it challenging to identify the root cause of hangs. To
> address this, we introduce a last_holder field to the semaphore structure,
> which is updated when a task successfully calls down() and cleared during
> up().
>
> The assumption is that if a task is blocked on a semaphore, the holders
> must not have released it. While this does not guarantee that the last
> holder is one of the current blockers, it likely provides a practical hint
> for diagnosing semaphore-related stalls.
>
> With this change, the hung task detector can now show blocker task's info
> like below:
Seems useful, but the semaphore code isn't really an akpm thing.
Peter, could you please comment?