diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-07-19 04:49:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:49 -0400 |
commit | 96645678cd726e87ce42a0664de71e047e32bca4 (patch) | |
tree | 116f568a090414777b481e8e5d9db55f420e4335 /kernel/lockdep_proc.c | |
parent | 443aef0eddfa44c158d1b94ebb431a70638fcab4 (diff) |
lockstat: measure lock bouncing
__acquire
|
lock _____
| \
| __contended
| |
| wait
| _______/
|/
|
__acquired
|
__release
|
unlock
We measure acquisition and contention bouncing.
This is done by recording a cpu stamp in each lock instance.
Contention bouncing requires the cpu stamp to be set on acquisition. Hence we
move __acquired into the generic path.
__acquired is then used to measure acquisition bouncing by comparing the
current cpu with the old stamp before replacing it.
__contended is used to measure contention bouncing (only useful for preemptable
locks)
[akpm@linux-foundation.org: cleanups]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/lockdep_proc.c')
-rw-r--r-- | kernel/lockdep_proc.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c index 39163ed1bf0a..7ff80135cbeb 100644 --- a/kernel/lockdep_proc.c +++ b/kernel/lockdep_proc.c | |||
@@ -430,16 +430,18 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data) | |||
430 | else | 430 | else |
431 | seq_printf(m, "%40s:", name); | 431 | seq_printf(m, "%40s:", name); |
432 | 432 | ||
433 | seq_printf(m, "%14lu ", stats->bounces[bounce_contended_write]); | ||
433 | seq_lock_time(m, &stats->write_waittime); | 434 | seq_lock_time(m, &stats->write_waittime); |
434 | seq_puts(m, " "); | 435 | seq_printf(m, " %14lu ", stats->bounces[bounce_acquired_write]); |
435 | seq_lock_time(m, &stats->write_holdtime); | 436 | seq_lock_time(m, &stats->write_holdtime); |
436 | seq_puts(m, "\n"); | 437 | seq_puts(m, "\n"); |
437 | } | 438 | } |
438 | 439 | ||
439 | if (stats->read_holdtime.nr) { | 440 | if (stats->read_holdtime.nr) { |
440 | seq_printf(m, "%38s-R:", name); | 441 | seq_printf(m, "%38s-R:", name); |
442 | seq_printf(m, "%14lu ", stats->bounces[bounce_contended_read]); | ||
441 | seq_lock_time(m, &stats->read_waittime); | 443 | seq_lock_time(m, &stats->read_waittime); |
442 | seq_puts(m, " "); | 444 | seq_printf(m, " %14lu ", stats->bounces[bounce_acquired_read]); |
443 | seq_lock_time(m, &stats->read_holdtime); | 445 | seq_lock_time(m, &stats->read_holdtime); |
444 | seq_puts(m, "\n"); | 446 | seq_puts(m, "\n"); |
445 | } | 447 | } |
@@ -469,26 +471,29 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data) | |||
469 | } | 471 | } |
470 | if (i) { | 472 | if (i) { |
471 | seq_puts(m, "\n"); | 473 | seq_puts(m, "\n"); |
472 | seq_line(m, '.', 0, 40 + 1 + 8 * (14 + 1)); | 474 | seq_line(m, '.', 0, 40 + 1 + 10 * (14 + 1)); |
473 | seq_puts(m, "\n"); | 475 | seq_puts(m, "\n"); |
474 | } | 476 | } |
475 | } | 477 | } |
476 | 478 | ||
477 | static void seq_header(struct seq_file *m) | 479 | static void seq_header(struct seq_file *m) |
478 | { | 480 | { |
479 | seq_printf(m, "lock_stat version 0.1\n"); | 481 | seq_printf(m, "lock_stat version 0.2\n"); |
480 | seq_line(m, '-', 0, 40 + 1 + 8 * (14 + 1)); | 482 | seq_line(m, '-', 0, 40 + 1 + 10 * (14 + 1)); |
481 | seq_printf(m, "%40s %14s %14s %14s %14s %14s %14s %14s %14s\n", | 483 | seq_printf(m, "%40s %14s %14s %14s %14s %14s %14s %14s %14s " |
484 | "%14s %14s\n", | ||
482 | "class name", | 485 | "class name", |
486 | "con-bounces", | ||
483 | "contentions", | 487 | "contentions", |
484 | "waittime-min", | 488 | "waittime-min", |
485 | "waittime-max", | 489 | "waittime-max", |
486 | "waittime-total", | 490 | "waittime-total", |
491 | "acq-bounces", | ||
487 | "acquisitions", | 492 | "acquisitions", |
488 | "holdtime-min", | 493 | "holdtime-min", |
489 | "holdtime-max", | 494 | "holdtime-max", |
490 | "holdtime-total"); | 495 | "holdtime-total"); |
491 | seq_line(m, '-', 0, 40 + 1 + 8 * (14 + 1)); | 496 | seq_line(m, '-', 0, 40 + 1 + 10 * (14 + 1)); |
492 | seq_printf(m, "\n"); | 497 | seq_printf(m, "\n"); |
493 | } | 498 | } |
494 | 499 | ||