* [PATCH v2] scsi: target: Save a few cycles in transport_lookup_[cmd|tmr]_lun()
@ 2022-08-15 20:52 Christophe JAILLET
2022-08-16 6:06 ` Chaitanya Kulkarni
0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2022-08-15 20:52 UTC (permalink / raw)
To: michael.christie, Martin K. Petersen
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-scsi,
target-devel
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>
---
Change in v2:
* sync with -next
v1:
* https://lore.kernel.org/all/e4a21bc607c39935cb98d4825cd63ba349820550.1635974637.git.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 b7f16ee8aa0e..76c6613a1da7 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 = 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 = 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.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] scsi: target: Save a few cycles in transport_lookup_[cmd|tmr]_lun()
2022-08-15 20:52 [PATCH v2] scsi: target: Save a few cycles in transport_lookup_[cmd|tmr]_lun() Christophe JAILLET
@ 2022-08-16 6:06 ` Chaitanya Kulkarni
2022-08-16 8:12 ` Christophe JAILLET
0 siblings, 1 reply; 3+ messages in thread
From: Chaitanya Kulkarni @ 2022-08-16 6:06 UTC (permalink / raw)
To: Christophe JAILLET
Cc: linux-kernel, michael.christie, kernel-janitors, linux-scsi,
target-devel, Martin K. Petersen
On 8/15/22 13:52, 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>
> ---
do you have a quantitative data that shows actual savings of cycles?
-ck
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] scsi: target: Save a few cycles in transport_lookup_[cmd|tmr]_lun()
2022-08-16 6:06 ` Chaitanya Kulkarni
@ 2022-08-16 8:12 ` Christophe JAILLET
0 siblings, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-08-16 8:12 UTC (permalink / raw)
To: Chaitanya Kulkarni
Cc: linux-kernel, michael.christie, kernel-janitors, linux-scsi,
target-devel, Martin K. Petersen
Le 16/08/2022 à 08:06, Chaitanya Kulkarni a écrit :
> On 8/15/22 13:52, 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>
>> ---
> do you have a quantitative data that shows actual savings of cycles?
>
> -ck
>
Some numbers were given for io_uring by the one who introduced
percpu_ref_tryget_live_rcu().
See [1].
I don't have specific numbers for the patch against scsi.
CJ
[1]:
https://lore.kernel.org/linux-kernel/cover.1634822969.git.asml.silence@gmail.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-16 10:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 20:52 [PATCH v2] scsi: target: Save a few cycles in transport_lookup_[cmd|tmr]_lun() Christophe JAILLET
2022-08-16 6:06 ` Chaitanya Kulkarni
2022-08-16 8:12 ` Christophe JAILLET
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).