History

rcu-tasks: Add grace-period and IPI counts to statistics

This commit adds a grace-period count and a count of IPIs sent since boot, which is printed in response to rcutorture writer stalls and at the end of rcutorture testing. These counts will be used to evaluate various schemes to reduce the number of IPIs sent.

Paul E. McKenney committed 6 years ago

Commit 238dbce1 parent 276c4101 file · +9 −1Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/rcu/tasks.h+9−1
@@ -30,6 +30,8 @@ typedef void (*postgp_func_t)(struct rcu_tasks *rtp); · 29 unmodified lines
3030 * @gp_state: Grace period's most recent state transition (debugging).
3131 * @gp_jiffies: Time of last @gp_state transition.
3232 * @gp_start: Most recent grace-period start in jiffies.
33+ * @n_gps: Number of grace periods completed since boot.
34+ * @n_ipis: Number of IPIs sent to encourage grace periods to end.
3335 * @pregp_func: This flavor's pre-grace-period function (optional).
3436 * @pertask_func: This flavor's per-task scan function (optional).
3537 * @postscan_func: This flavor's post-task scan function (optional).
@@ -47,6 +49,8 @@ struct rcu_tasks { · 11 unmodified lines
4749 int gp_state;
4850 unsigned long gp_jiffies;
4951 unsigned long gp_start;
52+ unsigned long n_gps;
53+ unsigned long n_ipis;
5054 struct task_struct *kthread_ptr;
5155 rcu_tasks_gp_func_t gp_func;
5256 pregp_func_t pregp_func;
@@ -208,6 +212,7 @@ static int __noreturn rcu_tasks_kthread(void *arg) · 155 unmodified lines
208212 set_tasks_gp_state(rtp, RTGS_WAIT_GP);
209213 rtp->gp_start = jiffies;
210214 rtp->gp_func(rtp);
215+ rtp->n_gps++;
211216
212217 /* Invoke the callbacks. */
213218 set_tasks_gp_state(rtp, RTGS_INVOKE_CBS);
@@ -285,11 +290,12 @@ static void __init rcu_tasks_bootup_oddness(void) · 71 unmodified lines
285290 /* Dump out rcutorture-relevant state common to all RCU-tasks flavors. */
286291 static void show_rcu_tasks_generic_gp_kthread(struct rcu_tasks *rtp, char *s)
287292 {
288− pr_info("%s: %s(%d) since %lu %c%c %s\n",
293+ pr_info("%s: %s(%d) since %lu g:%lu i:%lu %c%c %s\n",
289294 rtp->kname,
290295 tasks_gp_state_getname(rtp),
291296 data_race(rtp->gp_state),
292297 jiffies - data_race(rtp->gp_jiffies),
298+ data_race(rtp->n_gps), data_race(rtp->n_ipis),
293299 ".k"[!!data_race(rtp->kthread_ptr)],
294300 ".C"[!!data_race(rtp->cbs_head)],
295301 s);
@@ -592,6 +598,7 @@ static void rcu_tasks_be_rude(struct work_struct *work) · 296 unmodified lines
592598 // Wait for one rude RCU-tasks grace period.
593599 static void rcu_tasks_rude_wait_gp(struct rcu_tasks *rtp)
594600 {
601+ rtp->n_ipis += cpumask_weight(cpu_online_mask);
595602 schedule_on_each_cpu(rcu_tasks_be_rude);
596603 }
597604
@@ -856,6 +863,7 @@ static void trc_wait_for_one_reader(struct task_struct *t, · 258 unmodified lines
856863 atomic_inc(&trc_n_readers_need_end);
857864 per_cpu(trc_ipi_to_cpu, cpu) = true;
858865 t->trc_ipi_to_cpu = cpu;
866+ rcu_tasks_trace.n_ipis++;
859867 if (smp_call_function_single(cpu,
860868 trc_read_check_handler, t, 0)) {
861869 // Just in case there is some other reason for

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t