Skip to contentSkip to conversation

rcu/kvfree: Delay the execution of drain_page_cache()

PATCH In review Zqiang 2 participants 2 messages Apr 5, 2023 RCU

lore
Share & tools
lore

Zqiang

author
#0 lore raw

PATCH 1/1 rcu/kvfree: Delay the execution of drain_page_cache()

Currently, in kfree_rcu_shrink_scan(), the drain_page_cache() is executed before kfree_rcu_monitor() to drain page cache, if the bnode structure's->gp_snap has done, the kvfree_rcu_bulk() will fill the page cache again in kfree_rcu_monitor(), this commit therefore move drain_page_cache() after kfree_rcu_monitor() to drain page cache.

---
 kernel/rcu/tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree.c +1 -1
index 35be35f8236b..3461fc2640b9 100644
@@ -3424,8 +3424,8 @@ kfree_rcu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 		struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu);
 
 		count = krc_count(krcp);
-		count += drain_page_cache(krcp);
 		kfree_rcu_monitor(&krcp->monitor_work.work);
+		count += drain_page_cache(krcp);
 
 		sc->nr_to_scan -= count;
 		freed += count;
Signature · 1 line
2.32.0
maintainer
#1 lore raw
Quoted 28 lines · Zqiang

Currently, in kfree_rcu_shrink_scan(), the drain_page_cache() is executed before kfree_rcu_monitor() to drain page cache, if the bnode structure's->gp_snap has done, the kvfree_rcu_bulk() will fill the page cache again in kfree_rcu_monitor(), this commit therefore move drain_page_cache() after kfree_rcu_monitor() to drain page cache.

---
 kernel/rcu/tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree.c +1 -1
index 35be35f8236b..3461fc2640b9 100644
@@ -3424,8 +3424,8 @@ kfree_rcu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 		struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu);
 
 		count = krc_count(krcp);
-		count += drain_page_cache(krcp);
 		kfree_rcu_monitor(&krcp->monitor_work.work);
+		count += drain_page_cache(krcp);
 
 		sc->nr_to_scan -= count;
 		freed += count;
Signature · 1 line
2.32.0

One question. Maybe we can update the put_cached_bnode() with checking if backoff_page_cache_fill was set to prevent cache growing?

Thanks!

--
Uladzislau Rezki