rcu/kvfree: Make drain_page_cache() call return directly if cache is disabled
PATCH v2 1/1 rcu/kvfree: Make drain_page_cache() call return directly if cache is disabled
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.
--- kernel/rcu/tree.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/rcu/tree.c +3 -0
@@ -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 );
Signature · 1 line
2.32.0
Quoted 30 lines · Zqiang
If the
rcu_min_cached_objsis set to zero at boot params, thekrcp->page_cache_workwill not be triggered to fill page cache, and theput_cached_bnode()also does not fill page cache, this also means thekrcp->bkvcacheis always empty, so not need to acquire unnecessarykrcp->lockto get page fromkrcp->bkvcache, this commit therefore makedrain_page_cache()return directly if thercu_min_cached_objsis zero.Signed-off-by Zqiang <[email protected]>--- kernel/rcu/tree.c | 3 +++ 1 file changed, 3 insertions(+)kernel/rcu/tree.c +3
-0@@ -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 );Signature · 1 line
2.32.0
--
Uladzislau Rezki
Paul E. McKenney
maintainerQuoted 22 lines · Uladzislau Rezki
Quoted 21 lines · Zqiang
If the
rcu_min_cached_objsis set to zero at boot params, thekrcp->page_cache_workwill not be triggered to fill page cache, and theput_cached_bnode()also does not fill page cache, this also means thekrcp->bkvcacheis always empty, so not need to acquire unnecessarykrcp->lockto get page fromkrcp->bkvcache, this commit therefore makedrain_page_cache()return directly if thercu_min_cached_objsis zero.Signed-off-by Zqiang <[email protected]>--- kernel/rcu/tree.c | 3 +++ 1 file changed, 3 insertions(+)kernel/rcu/tree.c +0
-0@@ -2924,6 +2924,9 @@ drain_page_cache(struct kfree_rcu_cpu *krcp)struct llist_node *page_list, *pos, *n;int freed =0 ;
Quoted 10 lines
Quoted 9 lines
kernel/rcu/tree.c +3
-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 );Signature · 1 line
2.32.0Reviewed-by Uladzislau Rezki (Sony) <[email protected]>
Queued for further testing and review, thank you both!
Thanx, Paul