diff options
author | Glauber Costa <glommer@parallels.com> | 2012-10-19 10:20:27 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-10-24 02:39:16 -0400 |
commit | 0d7561c61d76690ed84bd1016acc0fcbff063205 (patch) | |
tree | 90870a84e7568020921d01300e73cc607410ff47 /mm/slub.c | |
parent | bcee6e2a13d580f6c21d748fcd7239ccc66cb4b8 (diff) |
sl[au]b: Process slabinfo_show in common code
With all the infrastructure in place, we can now have slabinfo_show
done from slab_common.c. A cache-specific function is called to grab
information about the cache itself, since that is still heavily
dependent on the implementation. But with the values produced by it, all
the printing and handling is done from common code.
Signed-off-by: Glauber Costa <glommer@parallels.com>
CC: Christoph Lameter <cl@linux.com>
CC: David Rientjes <rientjes@google.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 24 |
1 files changed, 10 insertions, 14 deletions
@@ -5405,18 +5405,14 @@ __initcall(slab_sysfs_init); | |||
5405 | * The /proc/slabinfo ABI | 5405 | * The /proc/slabinfo ABI |
5406 | */ | 5406 | */ |
5407 | #ifdef CONFIG_SLABINFO | 5407 | #ifdef CONFIG_SLABINFO |
5408 | int slabinfo_show(struct seq_file *m, void *p) | 5408 | void get_slabinfo(struct kmem_cache *s, struct slabinfo *sinfo) |
5409 | { | 5409 | { |
5410 | unsigned long nr_partials = 0; | 5410 | unsigned long nr_partials = 0; |
5411 | unsigned long nr_slabs = 0; | 5411 | unsigned long nr_slabs = 0; |
5412 | unsigned long nr_inuse = 0; | ||
5413 | unsigned long nr_objs = 0; | 5412 | unsigned long nr_objs = 0; |
5414 | unsigned long nr_free = 0; | 5413 | unsigned long nr_free = 0; |
5415 | struct kmem_cache *s; | ||
5416 | int node; | 5414 | int node; |
5417 | 5415 | ||
5418 | s = list_entry(p, struct kmem_cache, list); | ||
5419 | |||
5420 | for_each_online_node(node) { | 5416 | for_each_online_node(node) { |
5421 | struct kmem_cache_node *n = get_node(s, node); | 5417 | struct kmem_cache_node *n = get_node(s, node); |
5422 | 5418 | ||
@@ -5429,16 +5425,16 @@ int slabinfo_show(struct seq_file *m, void *p) | |||
5429 | nr_free += count_partial(n, count_free); | 5425 | nr_free += count_partial(n, count_free); |
5430 | } | 5426 | } |
5431 | 5427 | ||
5432 | nr_inuse = nr_objs - nr_free; | 5428 | sinfo->active_objs = nr_objs - nr_free; |
5429 | sinfo->num_objs = nr_objs; | ||
5430 | sinfo->active_slabs = nr_slabs; | ||
5431 | sinfo->num_slabs = nr_slabs; | ||
5432 | sinfo->objects_per_slab = oo_objects(s->oo); | ||
5433 | sinfo->cache_order = oo_order(s->oo); | ||
5434 | } | ||
5433 | 5435 | ||
5434 | seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d", s->name, nr_inuse, | 5436 | void slabinfo_show_stats(struct seq_file *m, struct kmem_cache *s) |
5435 | nr_objs, s->size, oo_objects(s->oo), | 5437 | { |
5436 | (1 << oo_order(s->oo))); | ||
5437 | seq_printf(m, " : tunables %4u %4u %4u", 0, 0, 0); | ||
5438 | seq_printf(m, " : slabdata %6lu %6lu %6lu", nr_slabs, nr_slabs, | ||
5439 | 0UL); | ||
5440 | seq_putc(m, '\n'); | ||
5441 | return 0; | ||
5442 | } | 5438 | } |
5443 | 5439 | ||
5444 | ssize_t slabinfo_write(struct file *file, const char __user *buffer, | 5440 | ssize_t slabinfo_write(struct file *file, const char __user *buffer, |