summaryrefslogtreecommitdiff
path: root/kernel/rcu/pending.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-08-14 18:45:08 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-08-19 22:04:25 -0400
commit3d84522f7f858684b36bd573e926302921da272d (patch)
tree6ae4adda4fbc3eb677731377a4b84821a1564889 /kernel/rcu/pending.c
parent1d7f9e1013ef3a9e3ee4803520ed83c3587e2c11 (diff)
rcu: Switch kvfree_rcu() to new rcu_pendingrcu_pending
This nets us a slight performance increase, and converts to common code. Todo - re-add the shrinker, so that memory reclaim can free expired objects and expedite a grace period when necessary. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'kernel/rcu/pending.c')
-rw-r--r--kernel/rcu/pending.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/rcu/pending.c b/kernel/rcu/pending.c
index c0e2351ba198..9c57f373d494 100644
--- a/kernel/rcu/pending.c
+++ b/kernel/rcu/pending.c
@@ -601,3 +601,23 @@ int rcu_pending_init(struct rcu_pending *pending,
return 0;
}
+
+#ifndef CONFIG_TINY_RCU
+/* kvfree_rcu */
+
+static struct rcu_pending kvfree_rcu_pending;
+
+void kvfree_call_rcu(struct rcu_head *head, void *ptr)
+{
+ BUG_ON(!ptr);
+
+ __rcu_pending_enqueue(&kvfree_rcu_pending, head, ptr, head == NULL);
+}
+EXPORT_SYMBOL_GPL(kvfree_call_rcu);
+
+void __init kvfree_rcu_pending_init(void)
+{
+ if (rcu_pending_init(&kvfree_rcu_pending, NULL, RCU_PENDING_KVFREE_FN))
+ panic("%s failed\n", __func__);
+}
+#endif