Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp900305pxb; Wed, 3 Nov 2021 14:26:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqhq6t37e65J4L3EBVqdLhew+wFJOm5+esdhcZnVr7Kq3zNOKFQUai4ClyahfK0u/c2LgY X-Received: by 2002:a02:9990:: with SMTP id a16mr752865jal.133.1635974789871; Wed, 03 Nov 2021 14:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635974789; cv=none; d=google.com; s=arc-20160816; b=0bGteR1ImUqZT2amUeE8teX3N/Id2DLXkrXCwxbYJWfIJY7E8yJ5NRYt/Z9c9mQfhW gojzbI1gqiUY0w+p4QuXiQ3Hem1013eo5+0P+s4OK709kjRv+4ZVKtmRx4KZDTNtZRIp REsvAWz8VGJoPqmOkGSvr9O1xJ61CbaVKuRGYZxmcuCA/OgvJYWku/SEYWQrDAQFk4gy EnoNCM0wrqYCR/fBkuRZImzp82sDfz0yMyW8vT+/BYhvE294RWWOyB9ihuA3vFSb8iTr N0nKtSebvx3H33/iIbjR7Kumqtoh55xvXx9PSRs2jWWP6wUu+63l0nixYTee4d2w9StW Ez7Q== 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=iLmu7+WZmoRN4dh0qEfkvFuj1zW6BSMzrmwxBhTf/d4=; b=KA2oxmK7+6YDxShgUN/kGCPmjtrxaA2uKKLYQSaQwHJEmNAUBbgzASQoJaLR7IyTxZ qit6pCCmMs/EsbE4qIE190dJvd+4Kh0wkGEAAJ2wdZPuf9raJjoacIlwj4boQy6GWL9O dhGjEyUhFQ+eGFFXcncf/Uzv+WrNDAhRm8621gc2xSj73QZ0ACw1f8Pc0V0YgkQ9GkDL OrM95J+AOCa5Tu1fovlSLbe4/x5EmiGTdWyz5pqmms6VtARmm9t/h0FhOxpqi05iWGTM 0oX962+VSNGCOApxMniz5E66A/cBC4visL0GwXWpx+C355rp7I5rUzsss8AzFl5dV0D0 D1aA== 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.26.15; Wed, 03 Nov 2021 14:26:29 -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 S230334AbhKCV11 (ORCPT + 99 others); Wed, 3 Nov 2021 17:27:27 -0400 Received: from smtp02.smtpout.orange.fr ([80.12.242.124]:51530 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230070AbhKCV10 (ORCPT ); Wed, 3 Nov 2021 17:27:26 -0400 Received: from pop-os.home ([86.243.171.122]) by smtp.orange.fr with ESMTPA id iNkVmLbELBazoiNkWmwzkt; Wed, 03 Nov 2021 22:24:48 +0100 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Wed, 03 Nov 2021 22:24:48 +0100 X-ME-IP: 86.243.171.122 From: Christophe JAILLET To: martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] scsi: target: Save a few cycles in 'transport_lookup_[cmd|tmr]_lun()' Date: Wed, 3 Nov 2021 22:24:46 +0100 Message-Id: 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 --- drivers/target/target_core_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 44bb380e7390..bfd5d5606522 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -77,7 +77,7 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd) se_lun = rcu_dereference(deve->se_lun); - if (!percpu_ref_tryget_live(&se_lun->lun_ref)) { + if (!percpu_ref_tryget_live_rcu(&se_lun->lun_ref)) { se_lun = NULL; goto out_unlock; } @@ -154,7 +154,7 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd) if (deve) { se_lun = rcu_dereference(deve->se_lun); - if (!percpu_ref_tryget_live(&se_lun->lun_ref)) { + if (!percpu_ref_tryget_live_rcu(&se_lun->lun_ref)) { se_lun = NULL; goto out_unlock; } -- 2.30.2