[PATCH v2 16/17] delay_acct: Mark task's delays->lock as terminal spinlock

Waiman Long
2018-11-19T18:57:50Z

By making task's delays->lock a terminal spinlock, it reduces the
lockdep overhead when this lock is used.

Signed-off-by: Waiman Long <longman@redhat.com>
---
kernel/delayacct.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/delayacct.c b/kernel/delayacct.c
index 2a12b98..49dd8d3 100644
--- a/kernel/delayacct.c
+++ b/kernel/delayacct.c
@@ -43,8 +43,10 @@ void delayacct_init(void)
void __delayacct_tsk_init(struct task_struct *tsk)
{
tsk->delays = kmem_cache_zalloc(delayacct_cache, GFP_KERNEL);
- if (tsk->delays)
+ if (tsk->delays) {
raw_spin_lock_init(&tsk->delays->lock);
+ lockdep_set_terminal_class(&tsk->delays->lock);
+ }
}

/*
--
1.8.3.1