The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] rcu/kvfree: Make drain_page_cache() call return directly if cache is disabled
@ 2023-04-18  7:02 Zqiang
  2023-04-18 12:05 ` Uladzislau Rezki
  0 siblings, 1 reply; 3+ messages in thread
From: Zqiang @ 2023-04-18  7:02 UTC (permalink / raw)
  To: urezki, paulmck, frederic, joel, qiang1.zhang
  Cc: qiang.zhang1211, rcu, linux-kernel

If the rcu_min_cached_objs is set to zero at boot params, the
krcp->page_cache_work will not be triggered to fill page cache,
and the put_cached_bnode() also does not fill page cache, this
also means the krcp->bkvcache is always empty, so not need to
acquire unnecessary krcp->lock to get page from krcp->bkvcache,
this commit therefore make drain_page_cache() return directly if
the rcu_min_cached_objs is zero.

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 kernel/rcu/tree.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index c8ba2be026fa..ce995fc1c644 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2924,6 +2924,9 @@ drain_page_cache(struct kfree_rcu_cpu *krcp)
 	struct llist_node *page_list, *pos, *n;
 	int freed = 0;
 
+	if (rcu_min_cached_objs)
+		return 0;
+
 	raw_spin_lock_irqsave(&krcp->lock, flags);
 	page_list = llist_del_all(&krcp->bkvcache);
 	WRITE_ONCE(krcp->nr_bkv_objs, 0);
-- 
2.32.0


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

* Re: [PATCH] rcu/kvfree: Make drain_page_cache() call return directly if cache is disabled
  2023-04-18  7:02 [PATCH] rcu/kvfree: Make drain_page_cache() call return directly if cache is disabled Zqiang
@ 2023-04-18 12:05 ` Uladzislau Rezki
  2023-04-18 12:25   ` Zhang, Qiang1
  0 siblings, 1 reply; 3+ messages in thread
From: Uladzislau Rezki @ 2023-04-18 12:05 UTC (permalink / raw)
  To: Zqiang; +Cc: urezki, paulmck, frederic, joel, qiang.zhang1211, rcu,
	linux-kernel

On Tue, Apr 18, 2023 at 03:02:59PM +0800, Zqiang wrote:
> If the rcu_min_cached_objs is set to zero at boot params, the
> krcp->page_cache_work will not be triggered to fill page cache,
> and the put_cached_bnode() also does not fill page cache, this
> also means the krcp->bkvcache is always empty, so not need to
> acquire unnecessary krcp->lock to get page from krcp->bkvcache,
> this commit therefore make drain_page_cache() return directly if
> the rcu_min_cached_objs is zero.
> 
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> ---
>  kernel/rcu/tree.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index c8ba2be026fa..ce995fc1c644 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2924,6 +2924,9 @@ drain_page_cache(struct kfree_rcu_cpu *krcp)
>  	struct llist_node *page_list, *pos, *n;
>  	int freed = 0;
>  
> +	if (rcu_min_cached_objs)
> +		return 0;
> +
>
Should we check for zero?

--
Uladzislau Rezki

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

* RE: [PATCH] rcu/kvfree: Make drain_page_cache() call return directly if cache is disabled
  2023-04-18 12:05 ` Uladzislau Rezki
@ 2023-04-18 12:25   ` Zhang, Qiang1
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qiang1 @ 2023-04-18 12:25 UTC (permalink / raw)
  To: Uladzislau Rezki
  Cc: paulmck@kernel.org, frederic@kernel.org, joel@joelfernandes.org,
	qiang.zhang1211@gmail.com, rcu@vger.kernel.org,
	linux-kernel@vger.kernel.org

> If the rcu_min_cached_objs is set to zero at boot params, the
> krcp->page_cache_work will not be triggered to fill page cache,
> and the put_cached_bnode() also does not fill page cache, this
> also means the krcp->bkvcache is always empty, so not need to
> acquire unnecessary krcp->lock to get page from krcp->bkvcache,
> this commit therefore make drain_page_cache() return directly if
> the rcu_min_cached_objs is zero.
> 
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> ---
>  kernel/rcu/tree.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index c8ba2be026fa..ce995fc1c644 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2924,6 +2924,9 @@ drain_page_cache(struct kfree_rcu_cpu *krcp)
>  	struct llist_node *page_list, *pos, *n;
>  	int freed = 0;
>  
> +	if (rcu_min_cached_objs)
> +		return 0;
> +
>
>Should we check for zero?
>

I am so sorry,  It's my mistake. I will resend.

Thanks
Zqiang

>
>--
>Uladzislau Rezki

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

end of thread, other threads:[~2023-04-18 12:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-18  7:02 [PATCH] rcu/kvfree: Make drain_page_cache() call return directly if cache is disabled Zqiang
2023-04-18 12:05 ` Uladzislau Rezki
2023-04-18 12:25   ` Zhang, Qiang1

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