Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp906703pxb; Wed, 3 Nov 2021 14:33:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL0i36xoRdOZ7V0ELoHrBi3hKPpxCRyvDqQ4+4QyWdyhUUTQqQIIydCQGhERxJolKz2m6s X-Received: by 2002:a05:6e02:1a81:: with SMTP id k1mr19582255ilv.163.1635975214331; Wed, 03 Nov 2021 14:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635975214; cv=none; d=google.com; s=arc-20160816; b=HrnMVg0FGbb86yP5fBbechQ7LOT5+fm1+uK/+qay1wfyuC9LiU89sEdReXiWIIxt+v DX3cT97KsUOTwCOWSTR87ocDtY5C1uZCVGNGVRBaTGDvMx1D62TDdPRftmyjHHNUODK6 Hdy4c2FHCkX4jIdbg39TSjZ718IAE7lyHLkSFcLd55/4xCya4OFfK9MSRq5TLQh64UXS cOVljio6dK6rkS499RIKfRxXzwRHRIrd9j67od9mRQizxY/YQLJt34WFJgF4qIHR4XLP ChnPmtFHReqxcL6ZeBdrWGp4OFD9CdAbLtTS50oKqm/vfldc3HXrO6wwrAoK4uQmBVU2 Rfzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=pTYDqC8riNVAKRlL9DGIyjkdfaQjA274YAzCwZv9stw=; b=JDG0qS94Ks2aEZ3IcXUftCDx9Uk+ng0/j4qXdoot4yBxbrPZ04Zhei0qhTtCJ0lRKP XYbFEExew2Utq6a/17Qt1o8npWdisBzJ0+TSd3LJqPYSgZ8CrYSNCWqp00HQ1nSlZNEa sB11kb4aMPYuOVhdFVtHMT4ahO58ni96nzg1Md0W8nk3MBIiIfzdHXCkHDm5oHyXLegX /QBhlJQV5EX+zjZAJD067Ubc9F5BNnLIu5THbUDUVZq0bicMd651oDHSgwpJPNfgVCfl Q79bx1+UEOniM2vDRywHDoGPVmf0MaGcGcDTjdXBV/pQHILQvZTGO2zc7PiSOgR50RRS KbLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f18si5618967jav.26.2021.11.03.14.33.15; Wed, 03 Nov 2021 14:33:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbhKCVeQ (ORCPT + 99 others); Wed, 3 Nov 2021 17:34:16 -0400 Received: from smtp02.smtpout.orange.fr ([80.12.242.124]:50246 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbhKCVeQ (ORCPT ); Wed, 3 Nov 2021 17:34:16 -0400 Received: from pop-os.home ([86.243.171.122]) by smtp.orange.fr with ESMTPA id iNr7mLdh7BazoiNr7mx0f3; Wed, 03 Nov 2021 22:31:38 +0100 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Wed, 03 Nov 2021 22:31:38 +0100 X-ME-IP: 86.243.171.122 From: Christophe JAILLET To: bcrl@kvack.org, viro@zeniv.linux.org.uk Cc: linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] aio: Save a few cycles in 'lookup_ioctx()' Date: Wed, 3 Nov 2021 22:31:35 +0100 Message-Id: <0c3fcdaec33bb12b2367860dfab7ed4224ea000c.1635974999.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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