Re: [PATCH] locking/ww_mutex: Initialize waiter.ww_ctx properly

From: Sebastian Andrzej Siewior
Date: Thu Aug 19 2021 - 14:33:02 EST


On 2021-08-19 20:22:38 [+0200], Peter Zijlstra wrote:
> > @@ -630,6 +628,7 @@ __mutex_lock_common(struct mutex *lock, unsigned int state, unsigned int subclas
> > ret = __ww_mutex_add_waiter(&waiter, lock, ww_ctx);
> > if (ret)
> > goto err_early_kill;
> > + waiter.ww_ctx = ww_ctx;
>
> Yeah, I suppose this works too, but I wanted to keep the waiter
> initialization together. Note how you've already called
> __ww_mutex_add_waiter() on it before you actually set part of the waiter
> state.

The wait_lock is held but yes, it ain't pretty.

Sebastian