diff options
Diffstat (limited to 'mm/slab.c')
-rw-r--r-- | mm/slab.c | 30 |
1 files changed, 6 insertions, 24 deletions
@@ -4157,26 +4157,17 @@ static void print_slabinfo_header(struct seq_file *m) | |||
4157 | static void *s_start(struct seq_file *m, loff_t *pos) | 4157 | static 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 | ||
4174 | static void *s_next(struct seq_file *m, void *p, loff_t *pos) | 4168 | static 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 | ||
4182 | static void s_stop(struct seq_file *m, void *p) | 4173 | static 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 | ||
4187 | static int s_show(struct seq_file *m, void *p) | 4178 | static 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 | ||
4356 | static void *leaks_start(struct seq_file *m, loff_t *pos) | 4347 | static 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 | ||
4371 | static inline int add_caller(unsigned long *n, unsigned long v) | 4353 | static 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 | ||
4431 | static int leaks_show(struct seq_file *m, void *p) | 4413 | static 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; |