Messages in this thread Patch in this message | | | Date | Wed, 8 Dec 2021 21:56:46 +0100 | From | Peter Zijlstra <> | Subject | Re: [RFC][PATCH 2/5] refcount: Use atomic_*_ofl() |
| |
On Wed, Dec 08, 2021 at 08:19:35PM +0100, Peter Zijlstra wrote: > On Wed, Dec 08, 2021 at 07:36:57PM +0100, Peter Zijlstra wrote: > > Use the shiny new atomic_*_ofl() functions in order to have better > > code-gen. > > > > *sigh*, so I forgot to adjust the other primitives to the slightly > tweaked range of these new functions..
Looks like it all just works. The add/sub stuff needs to check before and after anyway, and it saturing slightly earlier isn't a problem.
The only difference I found was, so I'll just fold that.
--- a/include/linux/refcount.h +++ b/include/linux/refcount.h @@ -346,7 +346,7 @@ static inline void __refcount_dec(refcou if (oldp) *oldp = old; - if (unlikely(old <= 1)) + if (unlikely(old - 1 <= 0)) refcount_warn_saturate(r, REFCOUNT_DEC_LEAK); }
| |