Re: [PATCH 2/3] refcount: introduce __refcount_dec_and_lock macro

From: Peter Zijlstra
Date: Thu Nov 09 2023 - 04:33:09 EST


On Mon, Nov 06, 2023 at 02:11:37PM -0500, Alexander Aring wrote:
> This patch adds the __refcount_dec_and_lock macro to generate code for a
> lock specific refcount_dec_and_lock implementation. Existing
> refcount_dec_and_lock implementation are updated to use the new
> __refcount_dec_and_lock macro. In future other lock implementation can
> added to use the refcount_dec_and_lock trick to only hold the lock when
> the refcount is going to be zero. Per subsystem own lock implementation
> can use the macro as well to provide such implementation for their own
> locking type.
>
> Co-developed: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Signed-off-by: Alexander Aring <aahringo@xxxxxxxxxx>

Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>