public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI/P2PDMA: Save a few cycles in 'pci_alloc_p2pmem()'
@ 2021-11-03 21:16 Christophe JAILLET
  2021-11-14  4:24 ` Krzysztof Wilczyński
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Christophe JAILLET @ 2021-11-03 21:16 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linux-kernel, kernel-janitors, Christophe JAILLET

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/pci/p2pdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 8d47cb7218d1..081c391690d4 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -710,7 +710,7 @@ void *pci_alloc_p2pmem(struct pci_dev *pdev, size_t size)
 	if (!ret)
 		goto out;
 
-	if (unlikely(!percpu_ref_tryget_live(ref))) {
+	if (unlikely(!percpu_ref_tryget_live_rcu(ref))) {
 		gen_pool_free(p2pdma->pool, (unsigned long) ret, size);
 		ret = NULL;
 		goto out;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-12-15 22:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-03 21:16 [PATCH] PCI/P2PDMA: Save a few cycles in 'pci_alloc_p2pmem()' Christophe JAILLET
2021-11-14  4:24 ` Krzysztof Wilczyński
2021-12-15 17:35 ` Bjorn Helgaas
2021-12-15 21:37   ` Logan Gunthorpe
2021-12-15 21:47     ` Bjorn Helgaas
2021-12-15 21:51       ` Logan Gunthorpe
2021-12-15 22:04         ` Bjorn Helgaas
2021-12-15 22:07           ` Logan Gunthorpe
2021-12-15 21:58 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox