aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
authorPavel Emelianov <xemul@sw.ru>2007-07-16 02:38:04 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:35 -0400
commitb92151bab91ef906378d3e0e7128d55dd641e966 (patch)
tree81f96a5976bcc749c42a9ae293e16667ea2d9afe /mm/slab.c
parent68e116a3b57d09b220fe38712bebd956b6dbbbc6 (diff)
Make /proc/slabinfo use seq_list_xxx helpers
This entry prints a header in .start callback. This is OK, but the more elegant solution would be to move this into the .show callback and use seq_list_start_head() in .start one. I have left it as is in order to make the patch just switch to new API and noting more. [adobriyan@sw.ru: Wrong pointer was used as kmem_cache pointer] Signed-off-by: Pavel Emelianov <xemul@openvz.org> Cc: Christoph Lameter <clameter@sgi.com> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/mm/slab.c b/mm/slab.c
index b344e6707128..a6a2fcf8195e 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4157,26 +4157,17 @@ static void print_slabinfo_header(struct seq_file *m)
4157static void *s_start(struct seq_file *m, loff_t *pos) 4157static void *s_start(struct seq_file *m, loff_t *pos)
4158{ 4158{
4159 loff_t n = *pos; 4159 loff_t n = *pos;
4160 struct list_head *p;
4161 4160
4162 mutex_lock(&cache_chain_mutex); 4161 mutex_lock(&cache_chain_mutex);
4163 if (!n) 4162 if (!n)
4164 print_slabinfo_header(m); 4163 print_slabinfo_header(m);
4165 p = cache_chain.next; 4164
4166 while (n--) { 4165 return seq_list_start(&cache_chain, *pos);
4167 p = p->next;
4168 if (p == &cache_chain)
4169 return NULL;
4170 }
4171 return list_entry(p, struct kmem_cache, next);
4172} 4166}
4173 4167
4174static void *s_next(struct seq_file *m, void *p, loff_t *pos) 4168static void *s_next(struct seq_file *m, void *p, loff_t *pos)
4175{ 4169{
4176 struct kmem_cache *cachep = p; 4170 return seq_list_next(p, &cache_chain, pos);
4177 ++*pos;
4178 return cachep->next.next == &cache_chain ?
4179 NULL : list_entry(cachep->next.next, struct kmem_cache, next);
4180} 4171}
4181 4172
4182static void s_stop(struct seq_file *m, void *p) 4173static void s_stop(struct seq_file *m, void *p)
@@ -4186,7 +4177,7 @@ static void s_stop(struct seq_file *m, void *p)
4186 4177
4187static int s_show(struct seq_file *m, void *p) 4178static int s_show(struct seq_file *m, void *p)
4188{ 4179{
4189 struct kmem_cache *cachep = p; 4180 struct kmem_cache *cachep = list_entry(p, struct kmem_cache, next);
4190 struct slab *slabp; 4181 struct slab *slabp;
4191 unsigned long active_objs; 4182 unsigned long active_objs;
4192 unsigned long num_objs; 4183 unsigned long num_objs;
@@ -4355,17 +4346,8 @@ ssize_t slabinfo_write(struct file *file, const char __user * buffer,
4355 4346
4356static void *leaks_start(struct seq_file *m, loff_t *pos) 4347static void *leaks_start(struct seq_file *m, loff_t *pos)
4357{ 4348{
4358 loff_t n = *pos;
4359 struct list_head *p;
4360
4361 mutex_lock(&cache_chain_mutex); 4349 mutex_lock(&cache_chain_mutex);
4362 p = cache_chain.next; 4350 return seq_list_start(&cache_chain, *pos);
4363 while (n--) {
4364 p = p->next;
4365 if (p == &cache_chain)
4366 return NULL;
4367 }
4368 return list_entry(p, struct kmem_cache, next);
4369} 4351}
4370 4352
4371static inline int add_caller(unsigned long *n, unsigned long v) 4353static inline int add_caller(unsigned long *n, unsigned long v)
@@ -4430,7 +4412,7 @@ static void show_symbol(struct seq_file *m, unsigned long address)
4430 4412
4431static int leaks_show(struct seq_file *m, void *p) 4413static int leaks_show(struct seq_file *m, void *p)
4432{ 4414{
4433 struct kmem_cache *cachep = p; 4415 struct kmem_cache *cachep = list_entry(p, struct kmem_cache, next);
4434 struct slab *slabp; 4416 struct slab *slabp;
4435 struct kmem_list3 *l3; 4417 struct kmem_list3 *l3;
4436 const char *name; 4418 const char *name;