diff options
| author | Paul Mundt <lethal@linux-sh.org> | 2009-12-14 22:10:10 -0500 |
|---|---|---|
| committer | Paul Mundt <lethal@linux-sh.org> | 2009-12-14 22:10:10 -0500 |
| commit | e0aa51f54faa0659b529143de6c608e76675326f (patch) | |
| tree | 22fc566b74bfe6bd612a858ba354818900cdc394 /kernel/lockdep.c | |
| parent | 9f815a1765b0ce766ab1d26ef192d30410f70b2b (diff) | |
| parent | 3ea6b3d0e6d0ffd91c0f8cadeb69b7133c038b32 (diff) | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'kernel/lockdep.c')
| -rw-r--r-- | kernel/lockdep.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index f5dcd36d3151..429540c70d3f 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
| @@ -140,7 +140,8 @@ static inline struct lock_class *hlock_class(struct held_lock *hlock) | |||
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | #ifdef CONFIG_LOCK_STAT | 142 | #ifdef CONFIG_LOCK_STAT |
| 143 | static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], lock_stats); | 143 | static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], |
| 144 | cpu_lock_stats); | ||
| 144 | 145 | ||
| 145 | static inline u64 lockstat_clock(void) | 146 | static inline u64 lockstat_clock(void) |
| 146 | { | 147 | { |
| @@ -168,7 +169,7 @@ static void lock_time_inc(struct lock_time *lt, u64 time) | |||
| 168 | if (time > lt->max) | 169 | if (time > lt->max) |
| 169 | lt->max = time; | 170 | lt->max = time; |
| 170 | 171 | ||
| 171 | if (time < lt->min || !lt->min) | 172 | if (time < lt->min || !lt->nr) |
| 172 | lt->min = time; | 173 | lt->min = time; |
| 173 | 174 | ||
| 174 | lt->total += time; | 175 | lt->total += time; |
| @@ -177,8 +178,15 @@ static void lock_time_inc(struct lock_time *lt, u64 time) | |||
| 177 | 178 | ||
| 178 | static inline void lock_time_add(struct lock_time *src, struct lock_time *dst) | 179 | static inline void lock_time_add(struct lock_time *src, struct lock_time *dst) |
| 179 | { | 180 | { |
| 180 | dst->min += src->min; | 181 | if (!src->nr) |
| 181 | dst->max += src->max; | 182 | return; |
| 183 | |||
| 184 | if (src->max > dst->max) | ||
| 185 | dst->max = src->max; | ||
| 186 | |||
| 187 | if (src->min < dst->min || !dst->nr) | ||
| 188 | dst->min = src->min; | ||
| 189 | |||
| 182 | dst->total += src->total; | 190 | dst->total += src->total; |
| 183 | dst->nr += src->nr; | 191 | dst->nr += src->nr; |
| 184 | } | 192 | } |
| @@ -191,7 +199,7 @@ struct lock_class_stats lock_stats(struct lock_class *class) | |||
| 191 | memset(&stats, 0, sizeof(struct lock_class_stats)); | 199 | memset(&stats, 0, sizeof(struct lock_class_stats)); |
| 192 | for_each_possible_cpu(cpu) { | 200 | for_each_possible_cpu(cpu) { |
| 193 | struct lock_class_stats *pcs = | 201 | struct lock_class_stats *pcs = |
| 194 | &per_cpu(lock_stats, cpu)[class - lock_classes]; | 202 | &per_cpu(cpu_lock_stats, cpu)[class - lock_classes]; |
| 195 | 203 | ||
| 196 | for (i = 0; i < ARRAY_SIZE(stats.contention_point); i++) | 204 | for (i = 0; i < ARRAY_SIZE(stats.contention_point); i++) |
| 197 | stats.contention_point[i] += pcs->contention_point[i]; | 205 | stats.contention_point[i] += pcs->contention_point[i]; |
| @@ -218,7 +226,7 @@ void clear_lock_stats(struct lock_class *class) | |||
| 218 | 226 | ||
| 219 | for_each_possible_cpu(cpu) { | 227 | for_each_possible_cpu(cpu) { |
| 220 | struct lock_class_stats *cpu_stats = | 228 | struct lock_class_stats *cpu_stats = |
| 221 | &per_cpu(lock_stats, cpu)[class - lock_classes]; | 229 | &per_cpu(cpu_lock_stats, cpu)[class - lock_classes]; |
| 222 | 230 | ||
| 223 | memset(cpu_stats, 0, sizeof(struct lock_class_stats)); | 231 | memset(cpu_stats, 0, sizeof(struct lock_class_stats)); |
| 224 | } | 232 | } |
| @@ -228,12 +236,12 @@ void clear_lock_stats(struct lock_class *class) | |||
| 228 | 236 | ||
| 229 | static struct lock_class_stats *get_lock_stats(struct lock_class *class) | 237 | static struct lock_class_stats *get_lock_stats(struct lock_class *class) |
| 230 | { | 238 | { |
| 231 | return &get_cpu_var(lock_stats)[class - lock_classes]; | 239 | return &get_cpu_var(cpu_lock_stats)[class - lock_classes]; |
| 232 | } | 240 | } |
| 233 | 241 | ||
| 234 | static void put_lock_stats(struct lock_class_stats *stats) | 242 | static void put_lock_stats(struct lock_class_stats *stats) |
| 235 | { | 243 | { |
| 236 | put_cpu_var(lock_stats); | 244 | put_cpu_var(cpu_lock_stats); |
| 237 | } | 245 | } |
| 238 | 246 | ||
| 239 | static void lock_release_holdtime(struct held_lock *hlock) | 247 | static void lock_release_holdtime(struct held_lock *hlock) |
| @@ -379,7 +387,8 @@ static int save_trace(struct stack_trace *trace) | |||
| 379 | * complete trace that maxes out the entries provided will be reported | 387 | * complete trace that maxes out the entries provided will be reported |
| 380 | * as incomplete, friggin useless </rant> | 388 | * as incomplete, friggin useless </rant> |
| 381 | */ | 389 | */ |
| 382 | if (trace->entries[trace->nr_entries-1] == ULONG_MAX) | 390 | if (trace->nr_entries != 0 && |
| 391 | trace->entries[trace->nr_entries-1] == ULONG_MAX) | ||
| 383 | trace->nr_entries--; | 392 | trace->nr_entries--; |
| 384 | 393 | ||
| 385 | trace->max_entries = trace->nr_entries; | 394 | trace->max_entries = trace->nr_entries; |
