Skip to content

Commit

Permalink
io_uring: initialize percpu refcounters using PERCU_REF_ALLOW_REINIT
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Signed-off-by: Dennis Zhou <[email protected]>
  • Loading branch information
rgushchin authored and dennisszhou committed May 9, 2019
1 parent 09ed79d commit 2148289
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2148289

Please sign in to comment.