From: Bjorn Helgaas <helgaas@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Logan Gunthorpe <logang@deltatee.com>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH] PCI/P2PDMA: Save a few cycles in 'pci_alloc_p2pmem()'
Date: Wed, 15 Dec 2021 11:35:56 -0600 [thread overview]
Message-ID: <20211215173556.GA702194@bhelgaas> (raw)
In-Reply-To: <ab80164f4d5b32f9e6240aa4863c3a147ff9c89f.1635974126.git.christophe.jaillet@wanadoo.fr>
[+cc Logan, Eric]
On Wed, Nov 03, 2021 at 10:16:53PM +0100, 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>
Added Logan and Eric since Logan is the author and de facto maintainer
of this file and Eric recently converted this to RCU.
Maybe we need a MAINTAINERS entry for P2PDMA?
> ---
> 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
>
next prev parent reply other threads:[~2021-12-15 17:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=20211215173556.GA702194@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=edumazet@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.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