[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1371B11E-CAA0-4428-8119-888AD0F9EF09@collabora.com>
Date: Tue, 2 Dec 2025 14:42:29 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Onur Özkan <work@...rozkan.dev>
Cc: rust-for-linux@...r.kernel.org,
lossin@...nel.org,
lyude@...hat.com,
ojeda@...nel.org,
alex.gaynor@...il.com,
boqun.feng@...il.com,
gary@...yguo.net,
a.hindborg@...nel.org,
aliceryhl@...gle.com,
tmgross@...ch.edu,
dakr@...nel.org,
peterz@...radead.org,
mingo@...hat.com,
will@...nel.org,
longman@...hat.com,
felipe_life@...e.com,
daniel@...lak.dev,
thomas.hellstrom@...ux.intel.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 2/6] ww_mutex: add `ww_class` field unconditionally
Hi Onur,
> On 1 Dec 2025, at 07:28, Onur Özkan <work@...rozkan.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@...rozkan.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@...labora.com>
Powered by blists - more mailing lists