lkml.org 
[lkml]   [2021]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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);
}

\
 
 \ /
  Last update: 2021-12-08 21:57    [W:0.041 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site