diff options
| -rw-r--r-- | mm/slub.c | 39 |
1 files changed, 18 insertions, 21 deletions
| @@ -3390,7 +3390,7 @@ static void process_slab(struct loc_track *t, struct kmem_cache *s, | |||
| 3390 | static int list_locations(struct kmem_cache *s, char *buf, | 3390 | static int list_locations(struct kmem_cache *s, char *buf, |
| 3391 | enum track_item alloc) | 3391 | enum track_item alloc) |
| 3392 | { | 3392 | { |
| 3393 | int n = 0; | 3393 | int len = 0; |
| 3394 | unsigned long i; | 3394 | unsigned long i; |
| 3395 | struct loc_track t = { 0, 0, NULL }; | 3395 | struct loc_track t = { 0, 0, NULL }; |
| 3396 | int node; | 3396 | int node; |
| @@ -3421,54 +3421,54 @@ static int list_locations(struct kmem_cache *s, char *buf, | |||
| 3421 | for (i = 0; i < t.count; i++) { | 3421 | for (i = 0; i < t.count; i++) { |
| 3422 | struct location *l = &t.loc[i]; | 3422 | struct location *l = &t.loc[i]; |
| 3423 | 3423 | ||
| 3424 | if (n > PAGE_SIZE - 100) | 3424 | if (len > PAGE_SIZE - 100) |
| 3425 | break; | 3425 | break; |
| 3426 | n += sprintf(buf + n, "%7ld ", l->count); | 3426 | len += sprintf(buf + len, "%7ld ", l->count); |
| 3427 | 3427 | ||
| 3428 | if (l->addr) | 3428 | if (l->addr) |
| 3429 | n += sprint_symbol(buf + n, (unsigned long)l->addr); | 3429 | len += sprint_symbol(buf + len, (unsigned long)l->addr); |
| 3430 | else | 3430 | else |
| 3431 | n += sprintf(buf + n, "<not-available>"); | 3431 | len += sprintf(buf + len, "<not-available>"); |
| 3432 | 3432 | ||
| 3433 | if (l->sum_time != l->min_time) { | 3433 | if (l->sum_time != l->min_time) { |
| 3434 | unsigned long remainder; | 3434 | unsigned long remainder; |
| 3435 | 3435 | ||
| 3436 | n += sprintf(buf + n, " age=%ld/%ld/%ld", | 3436 | len += sprintf(buf + len, " age=%ld/%ld/%ld", |
| 3437 | l->min_time, | 3437 | l->min_time, |
| 3438 | div_long_long_rem(l->sum_time, l->count, &remainder), | 3438 | div_long_long_rem(l->sum_time, l->count, &remainder), |
| 3439 | l->max_time); | 3439 | l->max_time); |
| 3440 | } else | 3440 | } else |
| 3441 | n += sprintf(buf + n, " age=%ld", | 3441 | len += sprintf(buf + len, " age=%ld", |
| 3442 | l->min_time); | 3442 | l->min_time); |
| 3443 | 3443 | ||
| 3444 | if (l->min_pid != l->max_pid) | 3444 | if (l->min_pid != l->max_pid) |
| 3445 | n += sprintf(buf + n, " pid=%ld-%ld", | 3445 | len += sprintf(buf + len, " pid=%ld-%ld", |
| 3446 | l->min_pid, l->max_pid); | 3446 | l->min_pid, l->max_pid); |
| 3447 | else | 3447 | else |
| 3448 | n += sprintf(buf + n, " pid=%ld", | 3448 | len += sprintf(buf + len, " pid=%ld", |
| 3449 | l->min_pid); | 3449 | l->min_pid); |
| 3450 | 3450 | ||
| 3451 | if (num_online_cpus() > 1 && !cpus_empty(l->cpus) && | 3451 | if (num_online_cpus() > 1 && !cpus_empty(l->cpus) && |
| 3452 | n < PAGE_SIZE - 60) { | 3452 | len < PAGE_SIZE - 60) { |
| 3453 | n += sprintf(buf + n, " cpus="); | 3453 | len += sprintf(buf + len, " cpus="); |
| 3454 | n += cpulist_scnprintf(buf + n, PAGE_SIZE - n - 50, | 3454 | len += cpulist_scnprintf(buf + len, PAGE_SIZE - len - 50, |
| 3455 | l->cpus); | 3455 | l->cpus); |
| 3456 | } | 3456 | } |
| 3457 | 3457 | ||
| 3458 | if (num_online_nodes() > 1 && !nodes_empty(l->nodes) && | 3458 | if (num_online_nodes() > 1 && !nodes_empty(l->nodes) && |
| 3459 | n < PAGE_SIZE - 60) { | 3459 | len < PAGE_SIZE - 60) { |
| 3460 | n += sprintf(buf + n, " nodes="); | 3460 | len += sprintf(buf + len, " nodes="); |
| 3461 | n += nodelist_scnprintf(buf + n, PAGE_SIZE - n - 50, | 3461 | len += nodelist_scnprintf(buf + len, PAGE_SIZE - len - 50, |
| 3462 | l->nodes); | 3462 | l->nodes); |
| 3463 | } | 3463 | } |
| 3464 | 3464 | ||
| 3465 | n += sprintf(buf + n, "\n"); | 3465 | len += sprintf(buf + len, "\n"); |
| 3466 | } | 3466 | } |
| 3467 | 3467 | ||
| 3468 | free_loc_track(&t); | 3468 | free_loc_track(&t); |
| 3469 | if (!t.count) | 3469 | if (!t.count) |
| 3470 | n += sprintf(buf, "No data\n"); | 3470 | len += sprintf(buf, "No data\n"); |
| 3471 | return n; | 3471 | return len; |
| 3472 | } | 3472 | } |
| 3473 | 3473 | ||
| 3474 | enum slab_stat_type { | 3474 | enum slab_stat_type { |
| @@ -3498,7 +3498,6 @@ static unsigned long slab_objects(struct kmem_cache *s, | |||
| 3498 | 3498 | ||
| 3499 | for_each_possible_cpu(cpu) { | 3499 | for_each_possible_cpu(cpu) { |
| 3500 | struct page *page; | 3500 | struct page *page; |
| 3501 | int node; | ||
| 3502 | struct kmem_cache_cpu *c = get_cpu_slab(s, cpu); | 3501 | struct kmem_cache_cpu *c = get_cpu_slab(s, cpu); |
| 3503 | 3502 | ||
| 3504 | if (!c) | 3503 | if (!c) |
| @@ -3510,8 +3509,6 @@ static unsigned long slab_objects(struct kmem_cache *s, | |||
| 3510 | continue; | 3509 | continue; |
| 3511 | if (page) { | 3510 | if (page) { |
| 3512 | if (flags & SO_CPU) { | 3511 | if (flags & SO_CPU) { |
| 3513 | int x = 0; | ||
| 3514 | |||
| 3515 | if (flags & SO_OBJECTS) | 3512 | if (flags & SO_OBJECTS) |
| 3516 | x = page->inuse; | 3513 | x = page->inuse; |
| 3517 | else | 3514 | else |
