On Wed, 19 Feb 2025 15:24:35 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
On Wed, 19 Feb 2025 15:18:57 -0500So something like this?
Waiman Long <llong@xxxxxxxxxx> wrote:
It is tricky to access the mutex_waiter structure which is allocatedAnd it's been on my TODO list for some time to try to make that structure
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
smaller again :-/
this field, we don't need to take lock, though taking the wait_lock mayBut perhaps if we add a new config option for this feature, we could just
still be needed to examine other information inside the mutex.
add the lock that a task is blocked on before it goes to sleep and
reference that instead. That would be easier than trying to play games
getting the lock owner from the blocked_on field.
unsigned int block_flags;
union {
struct mutex *mutex;
struct rwsem +rwsem;
struct rtmutex *rtmutex;
} blocked_on;
enum {
BLOCKED_ON_MUTEX;
BLOCKED_ON_RWSEM;
BLOCKED_ON_RTMUTEX;
BLOCKED_ON_IO;
} block_reason;
For the safety, we may anyway lock the task anyway, but that is the
same as stacktrace.
Thank you,
-- Steve