aboutsummaryrefslogtreecommitdiffstats
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorRoman Gushchin <guro@fb.com>2019-05-07 10:01:48 -0700
committerDennis Zhou <dennis@kernel.org>2019-05-09 10:50:30 -0700
commit214828962dead0c698f92b60ef97ce3c5fc2c8fe (patch)
tree31ef85d837693d35843ff56d719d89db4950794f /fs/io_uring.c
parentpercpu_ref: introduce PERCPU_REF_ALLOW_REINIT flag (diff)
downloadlinux-dev-214828962dead0c698f92b60ef97ce3c5fc2c8fe.tar.xz
linux-dev-214828962dead0c698f92b60ef97ce3c5fc2c8fe.zip
io_uring: initialize percpu refcounters using PERCU_REF_ALLOW_REINIT
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> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Dennis Zhou <dennis@kernel.org>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 84efb8956734..083c5dd95452 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -389,7 +389,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;
}