Re: [patch V5 41/72] locking/ww_mutex: Gather mutex_waiter initialization

From: Sebastian Andrzej Siewior
Date: Thu Aug 19 2021 - 14:28:55 EST


On 2021-08-19 20:17:53 [+0200], Peter Zijlstra wrote:
> You mean the 'use_ww_ctx && !ww_ctx' case?
>
> Would not the below also help with that?

Yes, it does, just tested.

> diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
> index 3a65bf4bacfd..d456579d0952 100644
> --- a/kernel/locking/mutex.c
> +++ b/kernel/locking/mutex.c
> @@ -618,7 +618,7 @@ __mutex_lock_common(struct mutex *lock, unsigned int state, unsigned int subclas
>
> debug_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);

Sebastian