From: tip-bot for Yong Zhang <yong.zhang0@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
a.p.zijlstra@chello.nl, mitake@dcl.info.waseda.ac.jp,
yong.zhang0@gmail.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:core/locking] lockdep: Always try to set ->class_cache in register_lock_class() lockdep_init_map()
Date: Fri, 18 Nov 2011 15:39:55 -0800 [thread overview]
Message-ID: <tip-87cdee71166fa107c5dc8e43060eeefa533c6a3b@git.kernel.org> (raw)
In-Reply-To: <20111109080714.GC8124@zhy>
Commit-ID: 87cdee71166fa107c5dc8e43060eeefa533c6a3b
Gitweb: http://git.kernel.org/tip/87cdee71166fa107c5dc8e43060eeefa533c6a3b
Author: Yong Zhang <yong.zhang0@gmail.com>
AuthorDate: Wed, 9 Nov 2011 16:07:14 +0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 14 Nov 2011 13:54:11 +0100
lockdep: Always try to set ->class_cache in register_lock_class() lockdep_init_map()
Commit ["62016250 lockdep: Add improved subclass caching"] tries to
improve performance (expecially to reduce the cost of rq->lock)
when using lockdep, but it fails due to lockdep_init_map() in
which ->class_cache is cleared. The typical caller is
lock_set_subclass(), after that class will not be cached anymore.
This patch tries to achive the goal of commit 62016250 by always
setting ->class_cache in register_lock_class().
=== Score comparison of benchmarks ===
for i in `seq 1 10`; do ./perf bench -f simple sched messaging; done
before: min: 0.604, max: 0.660, avg: 0.622
after: min: 0.414, max: 0.473, avg: 0.427
for i in `seq 1 10`; do ./perf bench -f simple sched messaging -g 40; done
before: min: 2.347, max: 2.421, avg: 2.391
after: min: 1.652, max: 1.699, avg: 1.671
Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20111109080714.GC8124@zhy
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/lockdep.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index e69434b..103bed8 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -722,7 +722,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
class = look_up_lock_class(lock, subclass);
if (likely(class))
- return class;
+ goto out_set_class_cache;
/*
* Debug-check: all keys must be persistent!
@@ -807,6 +807,7 @@ out_unlock_set:
graph_unlock();
raw_local_irq_restore(flags);
+out_set_class_cache:
if (!subclass || force)
lock->class_cache[0] = class;
else if (subclass < NR_LOCKDEP_CACHING_CLASSES)
next prev parent reply other threads:[~2011-11-18 23:40 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-04 9:26 [PATCH 0/4] patches to cure race in lock_set_class() Yong Zhang
2011-11-04 9:26 ` [PATCH 1/4] lockdep: lock_set_subclass() fix Yong Zhang
2011-11-07 12:34 ` Peter Zijlstra
2011-11-07 13:31 ` Yong Zhang
2011-11-07 14:03 ` Tejun Heo
2011-11-07 13:54 ` Borislav Petkov
2011-11-07 15:28 ` Vegard Nossum
2011-11-07 16:10 ` Peter Zijlstra
2011-11-07 16:21 ` Tejun Heo
2011-11-07 16:26 ` Peter Zijlstra
2011-11-08 2:58 ` Yong Zhang
2011-11-08 3:02 ` Yong Zhang
2011-11-08 7:56 ` Peter Zijlstra
2011-11-08 8:14 ` Yong Zhang
2011-11-08 8:46 ` Peter Zijlstra
2011-11-08 9:07 ` Yong Zhang
2011-11-08 9:37 ` Yong Zhang
2011-11-08 9:40 ` Peter Zijlstra
2011-11-09 8:04 ` [PATCH 1/2] lockdep: kmemcheck: annotate ->lock in lockdep_init_map() Yong Zhang
2011-11-09 8:07 ` [PATCH 2/2] lockdep: always try to set ->class_cache in register_lock_class() lockdep_init_map() Yong Zhang
2011-11-18 23:39 ` tip-bot for Yong Zhang [this message]
2011-12-06 9:39 ` [tip:core/locking] lockdep, kmemcheck: Annotate ->lock in lockdep_init_map() tip-bot for Yong Zhang
2011-12-06 19:56 ` David Rientjes
2011-12-06 20:14 ` [tip:perf/urgent] " tip-bot for Yong Zhang
2011-11-08 2:22 ` [PATCH 1/4] lockdep: lock_set_subclass() fix Yong Zhang
2011-11-04 9:26 ` [RFC PATCH 2/4] lockdep: Let register_lock_class() can be called with/without graph_lock Yong Zhang
2011-11-04 9:26 ` [RFC PATCH 3/4] lockdep: split lockdep_init_map() Yong Zhang
2011-11-04 9:26 ` [RFC PATCH 4/4] lockdep: fix race condition in __lock_set_class() Yong Zhang
2011-11-07 12:30 ` Peter Zijlstra
2011-11-07 13:26 ` Yong Zhang
2011-11-06 11:52 ` [PATCH 0/4] patches to cure race in lock_set_class() Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-87cdee71166fa107c5dc8e43060eeefa533c6a3b@git.kernel.org \
--to=yong.zhang0@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=mitake@dcl.info.waseda.ac.jp \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox