[PATCH v1 3/5] kvfree_rcu: Rename rcu_invoke_kfree_bulk_callback

From: Uladzislau Rezki (Sony)
Date: Wed Apr 28 2021 - 09:45:20 EST


The purpose of renaming is to have one common trace event
for APIs which use a special "bulk" form to release memory.

In our case we have kfree_bulk() and vfree_bulk(). It does
not make sense to implement two separate trace events which
would be identical expect for their names.

Rename it to "rcu_invoke_free_bulk_callback" and use it as
one trace event for both bulk API's.

Signed-off-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx>
---
include/trace/events/rcu.h | 4 ++--
kernel/rcu/tree.c | 16 +++++++++-------
2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index 918585d85af9..0855cb35ae4e 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -681,11 +681,11 @@ TRACE_EVENT_RCU(rcu_invoke_kvfree_callback,

/*
* Tracepoint for the invocation of a single RCU callback of the special
- * kfree_bulk() form. The first argument is the RCU flavor, the second
+ * "free bulk" form. The first argument is the RCU flavor, the second
* argument is a number of elements in array to free, the third is an
* address of the array holding nr_records entries.
*/
-TRACE_EVENT_RCU(rcu_invoke_kfree_bulk_callback,
+TRACE_EVENT_RCU(rcu_invoke_free_bulk_callback,

TP_PROTO(const char *rcuname, unsigned long nr_records, void **p),

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 6bf170d01cd5..e44d6f8c56f0 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3305,16 +3305,18 @@ static void kfree_rcu_work(struct work_struct *work)
debug_rcu_bhead_unqueue(bkvhead[i]);

rcu_lock_acquire(&rcu_callback_map);
- if (i == 0) { // kmalloc() / kfree().
- trace_rcu_invoke_kfree_bulk_callback(
- rcu_state.name, bkvhead[i]->nr_records,
- bkvhead[i]->records);

+ trace_rcu_invoke_free_bulk_callback(
+ rcu_state.name, bkvhead[i]->nr_records,
+ bkvhead[i]->records);
+
+ if (i == 0) // kmalloc() / kfree().
kfree_bulk(bkvhead[i]->nr_records,
bkvhead[i]->records);
- } else { // vmalloc() / vfree().
- vfree_bulk(bkvhead[i]->nr_records, bkvhead[i]->records);
- }
+ else // vmalloc() / vfree().
+ vfree_bulk(bkvhead[i]->nr_records,
+ bkvhead[i]->records);
+
rcu_lock_release(&rcu_callback_map);

raw_spin_lock_irqsave(&krcp->lock, flags);
--
2.20.1