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/slab.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/slab.c')
-rw-r--r-- | mm/slab.c | 26 |
1 files changed, 15 insertions, 11 deletions
@@ -4276,9 +4276,8 @@ out: | |||
4276 | } | 4276 | } |
4277 | 4277 | ||
4278 | #ifdef CONFIG_SLABINFO | 4278 | #ifdef CONFIG_SLABINFO |
4279 | int slabinfo_show(struct seq_file *m, void *p) | 4279 | void get_slabinfo(struct kmem_cache *cachep, struct slabinfo *sinfo) |
4280 | { | 4280 | { |
4281 | struct kmem_cache *cachep = list_entry(p, struct kmem_cache, list); | ||
4282 | struct slab *slabp; | 4281 | struct slab *slabp; |
4283 | unsigned long active_objs; | 4282 | unsigned long active_objs; |
4284 | unsigned long num_objs; | 4283 | unsigned long num_objs; |
@@ -4333,13 +4332,20 @@ int slabinfo_show(struct seq_file *m, void *p) | |||
4333 | if (error) | 4332 | if (error) |
4334 | printk(KERN_ERR "slab: cache %s error: %s\n", name, error); | 4333 | printk(KERN_ERR "slab: cache %s error: %s\n", name, error); |
4335 | 4334 | ||
4336 | seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d", | 4335 | sinfo->active_objs = active_objs; |
4337 | name, active_objs, num_objs, cachep->size, | 4336 | sinfo->num_objs = num_objs; |
4338 | cachep->num, (1 << cachep->gfporder)); | 4337 | sinfo->active_slabs = active_slabs; |
4339 | seq_printf(m, " : tunables %4u %4u %4u", | 4338 | sinfo->num_slabs = num_slabs; |
4340 | cachep->limit, cachep->batchcount, cachep->shared); | 4339 | sinfo->shared_avail = shared_avail; |
4341 | seq_printf(m, " : slabdata %6lu %6lu %6lu", | 4340 | sinfo->limit = cachep->limit; |
4342 | active_slabs, num_slabs, shared_avail); | 4341 | sinfo->batchcount = cachep->batchcount; |
4342 | sinfo->shared = cachep->shared; | ||
4343 | sinfo->objects_per_slab = cachep->num; | ||
4344 | sinfo->cache_order = cachep->gfporder; | ||
4345 | } | ||
4346 | |||
4347 | void slabinfo_show_stats(struct seq_file *m, struct kmem_cache *cachep) | ||
4348 | { | ||
4343 | #if STATS | 4349 | #if STATS |
4344 | { /* list3 stats */ | 4350 | { /* list3 stats */ |
4345 | unsigned long high = cachep->high_mark; | 4351 | unsigned long high = cachep->high_mark; |
@@ -4369,8 +4375,6 @@ int slabinfo_show(struct seq_file *m, void *p) | |||
4369 | allochit, allocmiss, freehit, freemiss); | 4375 | allochit, allocmiss, freehit, freemiss); |
4370 | } | 4376 | } |
4371 | #endif | 4377 | #endif |
4372 | seq_putc(m, '\n'); | ||
4373 | return 0; | ||
4374 | } | 4378 | } |
4375 | 4379 | ||
4376 | #define MAX_SLABINFO_WRITE 128 | 4380 | #define MAX_SLABINFO_WRITE 128 |