Hi Onur,
> On 1 Dec 2025, at 07:28, Onur Özkan <work@onurozkan.dev> wrote:
>
> Removes `DEBUG_WW_MUTEXES` guard on ww_class field
> from ww_acquire_ctx and ww_mutex.
>
> This helps us to write much safer Rust abstraction
> in very simple way.
Please extend this a bit. i.e.:
> This helps us to write much safer Rust abstraction in very simple way.
How so? This is what you should expand on in the commit message.
Also the wording/grammar is slightly off.
>
> Link: https://lore.kernel.org/all/ECC0425A-8B18-4626-8EA8-2F843C45E0A1@collabora.com/
> Signed-off-by: Onur Özkan <work@onurozkan.dev>
> ---
> include/linux/ww_mutex.h | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
> index 45ff6f7a872b..c9835035b6d6 100644
> --- a/include/linux/ww_mutex.h
> +++ b/include/linux/ww_mutex.h
> @@ -47,9 +47,7 @@ struct ww_class {
> struct ww_mutex {
> struct WW_MUTEX_BASE base;
> struct ww_acquire_ctx *ctx;
> -#ifdef DEBUG_WW_MUTEXES
> struct ww_class *ww_class;
> -#endif
> };
>
> struct ww_acquire_ctx {
> @@ -58,9 +56,9 @@ struct ww_acquire_ctx {
> unsigned int acquired;
> unsigned short wounded;
> unsigned short is_wait_die;
> + struct ww_class *ww_class;
> #ifdef DEBUG_WW_MUTEXES
> unsigned int done_acquire;
> - struct ww_class *ww_class;
> void *contending_lock;
> #endif
> #ifdef CONFIG_DEBUG_LOCK_ALLOC
> @@ -110,9 +108,7 @@ static inline void ww_mutex_init(struct ww_mutex *lock,
> {
> ww_mutex_base_init(&lock->base, ww_class->mutex_name, &ww_class->mutex_key);
> lock->ctx = NULL;
> -#ifdef DEBUG_WW_MUTEXES
> lock->ww_class = ww_class;
> -#endif
> }
>
> /**
> @@ -147,8 +143,8 @@ static inline void ww_acquire_init(struct ww_acquire_ctx *ctx,
> ctx->acquired = 0;
> ctx->wounded = false;
> ctx->is_wait_die = ww_class->is_wait_die;
> -#ifdef DEBUG_WW_MUTEXES
> ctx->ww_class = ww_class;
> +#ifdef DEBUG_WW_MUTEXES
> ctx->done_acquire = 0;
> ctx->contending_lock = NULL;
> #endif
> --
> 2.51.2
>
With the change above,
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>