[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YZCPcusrcCIJvYdn@rocinante>
Date: Sun, 14 Nov 2021 05:24:18 +0100
From: Krzysztof Wilczyński <kw@...ux.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: bhelgaas@...gle.com, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] PCI/P2PDMA: Save a few cycles in 'pci_alloc_p2pmem()'
Hi Christophe,
Thank you for another nice patch!
> 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.
If possible, we should explain why are we using this new API, especially
since percpu_ref_tryget_live_rcu() is a relatively new addition [1], so
it's obvious that its users already manage the RCU lock accordingly, and
that there is no need to hold the RCU read lock again (which can in turn
lead to performance improvement), which is what the percpu_ref_tryget_live()
does internally.
What do you think?
1. 3b13c168186c ("percpu_ref: percpu_ref_tryget_live() version holding RCU")
> 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;
Thank you!
Reviewed-by: Krzysztof Wilczyński <kw@...ux.com>
Krzysztof
Powered by blists - more mailing lists