Skip to content

Commit c29b5b3

Browse files
Muchun Songtorvalds
Muchun Song
authored andcommitted
mm: slab: make slab iterator functions static
There is no external users of slab_start/next/stop(), so make them static. And the memory.kmem.slabinfo is deprecated, which outputs nothing now, so move memcg_slab_show() into mm/memcontrol.c and rename it to mem_cgroup_slab_show to be consistent with other function names. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Muchun Song <[email protected]> Reviewed-by: Vlastimil Babka <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: David Rientjes <[email protected]> Cc: Joonsoo Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 7302e91 commit c29b5b3

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

mm/memcontrol.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4845,6 +4845,17 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
48454845
return ret;
48464846
}
48474847

4848+
#if defined(CONFIG_MEMCG_KMEM) && (defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG))
4849+
static int mem_cgroup_slab_show(struct seq_file *m, void *p)
4850+
{
4851+
/*
4852+
* Deprecated.
4853+
* Please, take a look at tools/cgroup/slabinfo.py .
4854+
*/
4855+
return 0;
4856+
}
4857+
#endif
4858+
48484859
static struct cftype mem_cgroup_legacy_files[] = {
48494860
{
48504861
.name = "usage_in_bytes",
@@ -4945,7 +4956,7 @@ static struct cftype mem_cgroup_legacy_files[] = {
49454956
(defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG))
49464957
{
49474958
.name = "kmem.slabinfo",
4948-
.seq_show = memcg_slab_show,
4959+
.seq_show = mem_cgroup_slab_show,
49494960
},
49504961
#endif
49514962
{

mm/slab.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,11 +575,6 @@ static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node)
575575

576576
#endif
577577

578-
void *slab_start(struct seq_file *m, loff_t *pos);
579-
void *slab_next(struct seq_file *m, void *p, loff_t *pos);
580-
void slab_stop(struct seq_file *m, void *p);
581-
int memcg_slab_show(struct seq_file *m, void *p);
582-
583578
#if defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG)
584579
void dump_unreclaimable_slab(void);
585580
#else

mm/slab_common.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,18 +1039,18 @@ static void print_slabinfo_header(struct seq_file *m)
10391039
seq_putc(m, '\n');
10401040
}
10411041

1042-
void *slab_start(struct seq_file *m, loff_t *pos)
1042+
static void *slab_start(struct seq_file *m, loff_t *pos)
10431043
{
10441044
mutex_lock(&slab_mutex);
10451045
return seq_list_start(&slab_caches, *pos);
10461046
}
10471047

1048-
void *slab_next(struct seq_file *m, void *p, loff_t *pos)
1048+
static void *slab_next(struct seq_file *m, void *p, loff_t *pos)
10491049
{
10501050
return seq_list_next(p, &slab_caches, pos);
10511051
}
10521052

1053-
void slab_stop(struct seq_file *m, void *p)
1053+
static void slab_stop(struct seq_file *m, void *p)
10541054
{
10551055
mutex_unlock(&slab_mutex);
10561056
}
@@ -1118,17 +1118,6 @@ void dump_unreclaimable_slab(void)
11181118
mutex_unlock(&slab_mutex);
11191119
}
11201120

1121-
#if defined(CONFIG_MEMCG_KMEM)
1122-
int memcg_slab_show(struct seq_file *m, void *p)
1123-
{
1124-
/*
1125-
* Deprecated.
1126-
* Please, take a look at tools/cgroup/slabinfo.py .
1127-
*/
1128-
return 0;
1129-
}
1130-
#endif
1131-
11321121
/*
11331122
* slabinfo_op - iterator that generates /proc/slabinfo
11341123
*

0 commit comments

Comments
 (0)