locking/ww_mutex: Initialize waiter.ww_ctx properly
Guenter Roeck
Tested-byQuoted 7 lines · Sebastian Andrzej Siewior
The gathering of the debug code for the ww-mutex initialized moved the POISON initialiation into one spot and only set waiter.ww_ctx if the
ww_ctxwas non-NULL thus keeping the POISON value in ww-mutex case.For ww-mutex without a context it is expected to set the context to NULL, the poison value was intended only for the regular mutex.
Quoted 6 lines
Always initialized waiter.ww_ctx to
ww_ctxin the ww-mutex case.Fixes c0afb0ffc06e6 ("locking/ww_mutex: Gather mutex_waiter initialization")Reported-by Guenter Roeck <[email protected]>Suggested-by Peter Zijlstra <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>
Tested-by Guenter Roeck <[email protected]>
Quoted 22 lines
---
v1…v2: Use PeterZ' approach.kernel/locking/mutex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/locking/mutex.c +1
-1@@ -614,7 +614,7 @@ __mutex_lock_common(struct mutex *lock, unsigned int state, unsigned int subclasdebug_mutex_lock_common (lock, &waiter); waiter.task = current; -if (ww_ctx) +if (use_ww_ctx) waiter.ww_ctx = ww_ctx;lock_contended (&lock->dep_map, ip);Signature · 1 line
2.33.0