Skip to content

Commit 6137079

Browse files
urezkipaulmckrcu
authored andcommitted
rcu: Add a trace event for kfree_rcu() use of kfree_bulk()
The event is given three parameters, first one is the name of RCU flavour, second one is the number of elements in array for free and last one is an address of the array holding pointers to be freed by the kfree_bulk() function. To enable the trace event your kernel has to be build with CONFIG_RCU_TRACE=y, after that it is possible to track the events using ftrace subsystem. Signed-off-by: Uladzislau Rezki (Sony) <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 34c8817 commit 6137079

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

include/trace/events/rcu.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,34 @@ TRACE_EVENT_RCU(rcu_invoke_kfree_callback,
623623
__entry->rcuname, __entry->rhp, __entry->offset)
624624
);
625625

626+
/*
627+
* Tracepoint for the invocation of a single RCU callback of the special
628+
* kfree_bulk() form. The first argument is the RCU flavor, the second
629+
* argument is a number of elements in array to free, the third is an
630+
* address of the array holding nr_records entries.
631+
*/
632+
TRACE_EVENT_RCU(rcu_invoke_kfree_bulk_callback,
633+
634+
TP_PROTO(const char *rcuname, unsigned long nr_records, void **p),
635+
636+
TP_ARGS(rcuname, nr_records, p),
637+
638+
TP_STRUCT__entry(
639+
__field(const char *, rcuname)
640+
__field(unsigned long, nr_records)
641+
__field(void **, p)
642+
),
643+
644+
TP_fast_assign(
645+
__entry->rcuname = rcuname;
646+
__entry->nr_records = nr_records;
647+
__entry->p = p;
648+
),
649+
650+
TP_printk("%s bulk=0x%p nr_records=%lu",
651+
__entry->rcuname, __entry->p, __entry->nr_records)
652+
);
653+
626654
/*
627655
* Tracepoint for exiting rcu_do_batch after RCU callbacks have been
628656
* invoked. The first argument is the name of the RCU flavor,

kernel/rcu/tree.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2792,6 +2792,9 @@ static void kfree_rcu_work(struct work_struct *work)
27922792
debug_rcu_head_unqueue_bulk(bhead->head_free_debug);
27932793

27942794
rcu_lock_acquire(&rcu_callback_map);
2795+
trace_rcu_invoke_kfree_bulk_callback(rcu_state.name,
2796+
bhead->nr_records, bhead->records);
2797+
27952798
kfree_bulk(bhead->nr_records, bhead->records);
27962799
rcu_lock_release(&rcu_callback_map);
27972800

0 commit comments

Comments
 (0)