aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorGlauber Costa <glommer@parallels.com>2012-10-19 10:20:25 -0400
committerPekka Enberg <penberg@kernel.org>2012-10-24 02:37:41 -0400
commitb7454ad3cfc3043c5264729a6204f049fe1f34b1 (patch)
treedbfe665034b9c3f3e79fa9410038ecc6f44e61bb /mm/slub.c
parentddffeb8c4d0331609ef2581d84de4d763607bd37 (diff)
mm/sl[au]b: Move slabinfo processing to slab_common.c
This patch moves all the common machinery to slabinfo processing to slab_common.c. We can do better by noticing that the output is heavily common, and having the allocators to just provide finished information about this. But after this first step, this can be done easier. Signed-off-by: Glauber Costa <glommer@parallels.com> Acked-by: 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.c51
1 files changed, 5 insertions, 46 deletions
diff --git a/mm/slub.c b/mm/slub.c
index a0d698467f70..77a0c8a9fc75 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5405,7 +5405,7 @@ __initcall(slab_sysfs_init);
5405 * The /proc/slabinfo ABI 5405 * The /proc/slabinfo ABI
5406 */ 5406 */
5407#ifdef CONFIG_SLABINFO 5407#ifdef CONFIG_SLABINFO
5408static void print_slabinfo_header(struct seq_file *m) 5408void print_slabinfo_header(struct seq_file *m)
5409{ 5409{
5410 seq_puts(m, "slabinfo - version: 2.1\n"); 5410 seq_puts(m, "slabinfo - version: 2.1\n");
5411 seq_puts(m, "# name <active_objs> <num_objs> <object_size> " 5411 seq_puts(m, "# name <active_objs> <num_objs> <object_size> "
@@ -5415,28 +5415,7 @@ static void print_slabinfo_header(struct seq_file *m)
5415 seq_putc(m, '\n'); 5415 seq_putc(m, '\n');
5416} 5416}
5417 5417
5418static void *s_start(struct seq_file *m, loff_t *pos) 5418int slabinfo_show(struct seq_file *m, void *p)
5419{
5420 loff_t n = *pos;
5421
5422 mutex_lock(&slab_mutex);
5423 if (!n)
5424 print_slabinfo_header(m);
5425
5426 return seq_list_start(&slab_caches, *pos);
5427}
5428
5429static void *s_next(struct seq_file *m, void *p, loff_t *pos)
5430{
5431 return seq_list_next(p, &slab_caches, pos);
5432}
5433
5434static void s_stop(struct seq_file *m, void *p)
5435{
5436 mutex_unlock(&slab_mutex);
5437}
5438
5439static int s_show(struct seq_file *m, void *p)
5440{ 5419{
5441 unsigned long nr_partials = 0; 5420 unsigned long nr_partials = 0;
5442 unsigned long nr_slabs = 0; 5421 unsigned long nr_slabs = 0;
@@ -5472,29 +5451,9 @@ static int s_show(struct seq_file *m, void *p)
5472 return 0; 5451 return 0;
5473} 5452}
5474 5453
5475static const struct seq_operations slabinfo_op = { 5454ssize_t slabinfo_write(struct file *file, const char __user *buffer,
5476 .start = s_start, 5455 size_t count, loff_t *ppos)
5477 .next = s_next,
5478 .stop = s_stop,
5479 .show = s_show,
5480};
5481
5482static int slabinfo_open(struct inode *inode, struct file *file)
5483{
5484 return seq_open(file, &slabinfo_op);
5485}
5486
5487static const struct file_operations proc_slabinfo_operations = {
5488 .open = slabinfo_open,
5489 .read = seq_read,
5490 .llseek = seq_lseek,
5491 .release = seq_release,
5492};
5493
5494static int __init slab_proc_init(void)
5495{ 5456{
5496 proc_create("slabinfo", S_IRUSR, NULL, &proc_slabinfo_operations); 5457 return -EIO;
5497 return 0;
5498} 5458}
5499module_init(slab_proc_init);
5500#endif /* CONFIG_SLABINFO */ 5459#endif /* CONFIG_SLABINFO */