Re: [PATCH v2 0/6] Rework REFCOUNT_FULL using atomic_fetch_* operations

From: Peter Zijlstra
Date: Wed Aug 28 2019 - 03:31:03 EST

On Tue, Aug 27, 2019 at 05:31:58PM +0100, Will Deacon wrote:
> Will Deacon (6):
> lib/refcount: Define constants for saturation and max refcount values
> lib/refcount: Ensure integer operands are treated as signed
> lib/refcount: Remove unused refcount_*_checked() variants
> lib/refcount: Move bulk of REFCOUNT_FULL implementation into header
> lib/refcount: Improve performance of generic REFCOUNT_FULL code
> lib/refcount: Consolidate REFCOUNT_{MAX,SATURATED} definitions

So I'm not a fan; I itch at the whole racy nature of this thing and I
find the code less than obvious. Yet, I have to agree it is exceedingly
unlikely the race will ever actually happen, I just don't want to be the
one having to debug it.

I've not looked at the implementation much; does it do all the same
checks the FULL one does? The x86-asm one misses a few iirc, so if this
is similarly fast but has all the checks, it is in fact better.

Can't we make this a default !FULL implementation?