[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211208205646.GB16608@worktop.programming.kicks-ass.net>
Date: Wed, 8 Dec 2021 21:56:46 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: will@...nel.org, boqun.feng@...il.com
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, mark.rutland@....com,
elver@...gle.com, keescook@...omium.org, hch@...radead.org,
torvalds@...ux-foundation.org
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);
}
Powered by blists - more mailing lists