2 # SPDX-License-Identifier: GPL-2.0+
4 # Dump out the number of RCU callbacks outstanding.
6 # On older kernels having multiple flavors of RCU, this dumps out the
7 # number of callbacks for the most heavily used flavor.
9 # Usage: sudo drgn rcu-cbs.py
11 # Copyright (C) 2021 Facebook, Inc.
13 # Authors: Paul E. McKenney <paulmck@kernel.org>
17 from drgn import NULL, Object
18 from drgn.helpers.linux import *
22 rdp0 = prog.variable('rcu_preempt_data', 'kernel/rcu/tree.c');
28 rdp0 = prog.variable('rcu_sched_data',
34 rdp0 = prog.variable('rcu_data', 'kernel/rcu/tree.c');
35 return rdp0.address_of_();
37 rdp0 = get_rdp0(prog);
39 # Sum up RCU callbacks.
41 for cpu in for_each_possible_cpu(prog):
42 rdp = per_cpu_ptr(rdp0, cpu);
43 len = rdp.cblist.len.value_();
44 # print("CPU " + str(cpu) + " RCU callbacks: " + str(len));
46 print("Number of RCU callbacks in flight: " + str(sum));