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

From: Waiman Long
Date: Wed Feb 19 2025 - 20:36:26 EST


On 2/19/25 5:56 PM, Masami Hiramatsu (Google) wrote:
On Wed, 19 Feb 2025 17:44:11 -0500
Waiman Long <llong@xxxxxxxxxx> wrote:

On 2/19/25 3:24 PM, Steven Rostedt wrote:
On Wed, 19 Feb 2025 15:18:57 -0500
Waiman Long <llong@xxxxxxxxxx> wrote:

It is tricky to access the mutex_waiter structure which is allocated
from stack. So another way to work around this issue is to add a new
blocked_on_mutex field in task_struct to directly point to relevant
mutex. Yes, that increase the size of task_struct by 8 bytes, but it is
a pretty large structure anyway. Using READ_ONCE/WRITE_ONCE() to access
And it's been on my TODO list for some time to try to make that structure
smaller again :-/
I agree to add the field, actually it was my first prototype :)

this field, we don't need to take lock, though taking the wait_lock may
still be needed to examine other information inside the mutex.
Do we need to take it just for accessing owner, which is in an atomic?

Right. I forgot it is an atomic_long_t. In that case, no lock should be needed.

Cheers,
Longman