mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Christie <michael.christie@oracle.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] scsi: target: Save a few cycles in 'transport_lookup_[cmd|tmr]_lun()'
Date: Fri, 12 Aug 2022 11:12:54 -0500	[thread overview]
Message-ID: <dd162258-bd3d-af1d-179c-e9d412f3f5c4@oracle.com> (raw)
In-Reply-To: <e4a21bc607c39935cb98d4825cd63ba349820550.1635974637.git.christophe.jaillet@wanadoo.fr>

On 11/3/21 4:24 PM, Christophe JAILLET wrote:
> 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>
> ---
>  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;
>  		}

The patch looks ok.

You just got a little unlucky because the Martin just put some
conflicting patches into his 5.20 staging branch:

https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/log/?h=5.20/scsi-staging

so I think you want to build your patch against that tree and branch.

      parent reply	other threads:[~2022-08-12 16:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 21:24 Christophe JAILLET
2022-08-12  4:52 ` Christophe JAILLET
2022-08-12 16:12 ` Mike Christie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dd162258-bd3d-af1d-179c-e9d412f3f5c4@oracle.com \
    --to=michael.christie@oracle.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®