From: Jens Axboe <axboe@kernel.dk>
To: Bart Van Assche <bvanassche@acm.org>,
Pavel Begunkov <asml.silence@gmail.com>,
io-uring@vger.kernel.org
Cc: Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>,
Christoph Lameter <cl@linux.com>, Joakim Hassila <joj@mac.com>
Subject: Re: [PATCH 1/2] percpu_ref: add percpu_ref_atomic_count()
Date: Fri, 16 Apr 2021 09:34:21 -0600 [thread overview]
Message-ID: <54cbda99-0cde-6b1c-e65a-0df96e290d90@kernel.dk> (raw)
In-Reply-To: <a393b2dd-bf2d-236d-8262-e908862789e4@acm.org>
On 4/16/21 9:31 AM, Bart Van Assche wrote:
> On 4/15/21 5:22 PM, Pavel Begunkov wrote:
>> diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c
>> index a1071cdefb5a..56286995e2b8 100644
>> --- a/lib/percpu-refcount.c
>> +++ b/lib/percpu-refcount.c
>> @@ -425,6 +425,32 @@ bool percpu_ref_is_zero(struct percpu_ref *ref)
>> }
>> EXPORT_SYMBOL_GPL(percpu_ref_is_zero);
>>
>> +/**
>> + * percpu_ref_atomic_count - returns number of left references
>> + * @ref: percpu_ref to test
>> + *
>> + * This function is safe to call as long as @ref is switch into atomic mode,
>> + * and is between init and exit.
>> + */
>
> How about using the name percpu_ref_read() instead of
> percpu_ref_atomic_count()?
Not sure we're going that route, but in any case, I think it's important
to have it visibly require the ref to be in atomic mode. Maybe
percpu_ref_read_atomic() would be better, but I do think 'atomic' has
to be in the name.
--
Jens Axboe
next prev parent reply other threads:[~2021-04-16 15:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-16 0:22 [PATCH 0/2] fix hangs with shared sqpoll Pavel Begunkov
2021-04-16 0:22 ` [PATCH 1/2] percpu_ref: add percpu_ref_atomic_count() Pavel Begunkov
2021-04-16 4:45 ` Dennis Zhou
2021-04-16 13:16 ` Pavel Begunkov
2021-04-16 14:10 ` Ming Lei
2021-04-16 14:37 ` Dennis Zhou
2021-04-19 2:03 ` Ming Lei
2021-04-16 15:31 ` Bart Van Assche
2021-04-16 15:34 ` Jens Axboe [this message]
2021-04-16 0:22 ` [PATCH 2/2] io_uring: fix shared sqpoll cancellation hangs Pavel Begunkov
2021-04-16 0:26 ` [PATCH 0/2] fix hangs with shared sqpoll Pavel Begunkov
2021-04-16 13:04 ` Jens Axboe
2021-04-16 13:12 ` Pavel Begunkov
2021-04-16 13:58 ` Jens Axboe
2021-04-16 14:09 ` Pavel Begunkov
2021-04-16 14:42 ` Pavel Begunkov
[not found] ` <20210417013115.15032-1-hdanton@sina.com>
2021-04-18 13:56 ` Pavel Begunkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54cbda99-0cde-6b1c-e65a-0df96e290d90@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=bvanassche@acm.org \
--cc=cl@linux.com \
--cc=dennis@kernel.org \
--cc=io-uring@vger.kernel.org \
--cc=joj@mac.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox