[RFC PATCH 11/12] cgroup: Mark the rstat percpu lock as terminal

From: Waiman Long
Date: Thu Nov 08 2018 - 15:36:35 EST


By classifying the cgroup rstat percpu locks as terminal locks, it
reduces the lockdep overhead when these locks are being used.

Signed-off-by: Waiman Long <longman@xxxxxxxxxx>
---
kernel/cgroup/rstat.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
index d503d1a..47f7ffb 100644
--- a/kernel/cgroup/rstat.c
+++ b/kernel/cgroup/rstat.c
@@ -291,8 +291,13 @@ void __init cgroup_rstat_boot(void)
{
int cpu;

- for_each_possible_cpu(cpu)
- raw_spin_lock_init(per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu));
+ for_each_possible_cpu(cpu) {
+ raw_spinlock_t *cgroup_rstat_percpu_lock =
+ per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu);
+
+ raw_spin_lock_init(cgroup_rstat_percpu_lock);
+ lockdep_set_terminal_class(cgroup_rstat_percpu_lock);
+ }

BUG_ON(cgroup_rstat_init(&cgrp_dfl_root.cgrp));
}
--
1.8.3.1