From: Roman Gushchin <guro@fb.com>
To: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Song Liu <songliubraving@fb.com>,
Dennis Zhou <dennis@kernel.org>, <linux-kernel@vger.kernel.org>,
<kernel-team@fb.com>, Roman Gushchin <guro@fb.com>
Subject: [PATCH 2/4] io_uring: initialize percpu refcounters using PERCU_REF_ALLOW_REINIT
Date: Tue, 7 May 2019 10:01:48 -0700 [thread overview]
Message-ID: <20190507170150.64051-2-guro@fb.com> (raw)
In-Reply-To: <20190507170150.64051-1-guro@fb.com>
Percpu reference counters should now be initialized with the
PERCPU_REF_ALLOW_REINIT in order to allow switching them to the
percpu mode from the atomic mode. This is exactly what
percpu_ref_reinit() called from __io_uring_register() is supposed to
do. So let's initialize percpu refcounters with the
PERCU_REF_ALLOW_REINIT flag.
Signed-off-by: Roman Gushchin <guro@fb.com>
---
fs/io_uring.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 452e35357865..9a9df175af31 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -397,7 +397,8 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
if (!ctx)
return NULL;
- if (percpu_ref_init(&ctx->refs, io_ring_ctx_ref_free, 0, GFP_KERNEL)) {
+ if (percpu_ref_init(&ctx->refs, io_ring_ctx_ref_free,
+ PERCPU_REF_ALLOW_REINIT, GFP_KERNEL)) {
kfree(ctx);
return NULL;
}
--
2.20.1
next prev parent reply other threads:[~2019-05-07 17:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 17:01 [PATCH 1/4] percpu_ref: introduce PERCPU_REF_ALLOW_REINIT flag Roman Gushchin
2019-05-07 17:01 ` Roman Gushchin [this message]
2019-05-07 17:01 ` [PATCH 3/4] md: initialize percpu refcounters using PERCU_REF_ALLOW_REINIT Roman Gushchin
2019-05-07 17:01 ` [PATCH 4/4] percpu_ref: release percpu memory early without PERCPU_REF_ALLOW_REINIT Roman Gushchin
2019-05-09 16:53 ` [PATCH 1/4] percpu_ref: introduce PERCPU_REF_ALLOW_REINIT flag Tejun Heo
2019-05-09 17:52 ` Dennis Zhou
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=20190507170150.64051-2-guro@fb.com \
--to=guro@fb.com \
--cc=axboe@kernel.dk \
--cc=dennis@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=songliubraving@fb.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