lkml.org 
[lkml]   [2021]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] aio: Save a few cycles in 'lookup_ioctx()'
Date
Use 'percpu_ref_tryget_live_rcu()' instead of 'percpu_ref_tryget_live()' to
save a few cycles when it is known that the rcu lock is already
taken/released.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
fs/aio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/aio.c b/fs/aio.c
index 9c81cf611d65..d189ea13e10a 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1062,7 +1062,7 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id)
id = array_index_nospec(id, table->nr);
ctx = rcu_dereference(table->table[id]);
if (ctx && ctx->user_id == ctx_id) {
- if (percpu_ref_tryget_live(&ctx->users))
+ if (percpu_ref_tryget_live_rcu(&ctx->users))
ret = ctx;
}
out:
--
2.30.2
\
 
 \ /
  Last update: 2021-11-03 22:32    [W:0.063 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site