diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slab.c | 8 | ||||
-rw-r--r-- | mm/slab.h | 1 | ||||
-rw-r--r-- | mm/slab_common.c | 15 |
3 files changed, 8 insertions, 16 deletions
@@ -4043,12 +4043,6 @@ ssize_t slabinfo_write(struct file *file, const char __user *buffer, | |||
4043 | 4043 | ||
4044 | #ifdef CONFIG_DEBUG_SLAB_LEAK | 4044 | #ifdef CONFIG_DEBUG_SLAB_LEAK |
4045 | 4045 | ||
4046 | static void *leaks_start(struct seq_file *m, loff_t *pos) | ||
4047 | { | ||
4048 | mutex_lock(&slab_mutex); | ||
4049 | return seq_list_start(&slab_caches, *pos); | ||
4050 | } | ||
4051 | |||
4052 | static inline int add_caller(unsigned long *n, unsigned long v) | 4046 | static inline int add_caller(unsigned long *n, unsigned long v) |
4053 | { | 4047 | { |
4054 | unsigned long *p; | 4048 | unsigned long *p; |
@@ -4170,7 +4164,7 @@ static int leaks_show(struct seq_file *m, void *p) | |||
4170 | } | 4164 | } |
4171 | 4165 | ||
4172 | static const struct seq_operations slabstats_op = { | 4166 | static const struct seq_operations slabstats_op = { |
4173 | .start = leaks_start, | 4167 | .start = slab_start, |
4174 | .next = slab_next, | 4168 | .next = slab_next, |
4175 | .stop = slab_stop, | 4169 | .stop = slab_stop, |
4176 | .show = leaks_show, | 4170 | .show = leaks_show, |
@@ -357,6 +357,7 @@ static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node) | |||
357 | 357 | ||
358 | #endif | 358 | #endif |
359 | 359 | ||
360 | void *slab_start(struct seq_file *m, loff_t *pos); | ||
360 | void *slab_next(struct seq_file *m, void *p, loff_t *pos); | 361 | void *slab_next(struct seq_file *m, void *p, loff_t *pos); |
361 | void slab_stop(struct seq_file *m, void *p); | 362 | void slab_stop(struct seq_file *m, void *p); |
362 | 363 | ||
diff --git a/mm/slab_common.c b/mm/slab_common.c index dcdab81bd240..06aeaf091f21 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -834,14 +834,9 @@ void print_slabinfo_header(struct seq_file *m) | |||
834 | seq_putc(m, '\n'); | 834 | seq_putc(m, '\n'); |
835 | } | 835 | } |
836 | 836 | ||
837 | static void *s_start(struct seq_file *m, loff_t *pos) | 837 | void *slab_start(struct seq_file *m, loff_t *pos) |
838 | { | 838 | { |
839 | loff_t n = *pos; | ||
840 | |||
841 | mutex_lock(&slab_mutex); | 839 | mutex_lock(&slab_mutex); |
842 | if (!n) | ||
843 | print_slabinfo_header(m); | ||
844 | |||
845 | return seq_list_start(&slab_caches, *pos); | 840 | return seq_list_start(&slab_caches, *pos); |
846 | } | 841 | } |
847 | 842 | ||
@@ -903,10 +898,12 @@ int cache_show(struct kmem_cache *s, struct seq_file *m) | |||
903 | return 0; | 898 | return 0; |
904 | } | 899 | } |
905 | 900 | ||
906 | static int s_show(struct seq_file *m, void *p) | 901 | static int slab_show(struct seq_file *m, void *p) |
907 | { | 902 | { |
908 | struct kmem_cache *s = list_entry(p, struct kmem_cache, list); | 903 | struct kmem_cache *s = list_entry(p, struct kmem_cache, list); |
909 | 904 | ||
905 | if (p == slab_caches.next) | ||
906 | print_slabinfo_header(m); | ||
910 | if (!is_root_cache(s)) | 907 | if (!is_root_cache(s)) |
911 | return 0; | 908 | return 0; |
912 | return cache_show(s, m); | 909 | return cache_show(s, m); |
@@ -926,10 +923,10 @@ static int s_show(struct seq_file *m, void *p) | |||
926 | * + further values on SMP and with statistics enabled | 923 | * + further values on SMP and with statistics enabled |
927 | */ | 924 | */ |
928 | static const struct seq_operations slabinfo_op = { | 925 | static const struct seq_operations slabinfo_op = { |
929 | .start = s_start, | 926 | .start = slab_start, |
930 | .next = slab_next, | 927 | .next = slab_next, |
931 | .stop = slab_stop, | 928 | .stop = slab_stop, |
932 | .show = s_show, | 929 | .show = slab_show, |
933 | }; | 930 | }; |
934 | 931 | ||
935 | static int slabinfo_open(struct inode *inode, struct file *file) | 932 | static int slabinfo_open(struct inode *inode, struct file *file) |