[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whStLWvUzmz3SmQxy1PPyNDjf1O-7z1mq5=WZ-+EABa7w@mail.gmail.com>
Date: Fri, 10 Dec 2021 09:27:48 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Will Deacon <will@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Marco Elver <elver@...gle.com>,
Kees Cook <keescook@...omium.org>,
Christoph Hellwig <hch@...radead.org>,
Jens Axboe <axboe@...nel.dk>
Subject: Re: [PATCH v2 8/9] atomic,x86: Alternative atomic_*_overflow() scheme
On Fri, Dec 10, 2021 at 8:53 AM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> That said - it may not matter - I'm not sure a plain "dec" is even a
> valid operation on a ref in the first place. How could you ever
> validly decrement a ref without checking for it being the last entry?
I should have checked the users - it seems to be a pattern at least in
networking where people have extra references and do
refcount_dec(&skb->users);
dev_kfree_skb_any(skb);
because there's no way to tell dev_kfree_skb*() to decrement more than once.
So I guess it's all good, but yes, I still think you can just do "lock
dec .. js" for this operation.
Linus
Powered by blists - more mailing lists