Skip to content

Commit

Permalink
mm: slab: make slab iterator functions static
Browse files Browse the repository at this point in the history
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/20211109133359.32881-1-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Muchun Song authored and Linus Torvalds committed Jan 15, 2022
1 parent 7302e91 commit c29b5b3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
13 changes: 12 additions & 1 deletion mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -4845,6 +4845,17 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
return ret;
}

#if defined(CONFIG_MEMCG_KMEM) && (defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG))
static int mem_cgroup_slab_show(struct seq_file *m, void *p)
{
/*
* Deprecated.
* Please, take a look at tools/cgroup/slabinfo.py .
*/
return 0;
}
#endif

static struct cftype mem_cgroup_legacy_files[] = {
{
.name = "usage_in_bytes",
Expand Down Expand Up @@ -4945,7 +4956,7 @@ static struct cftype mem_cgroup_legacy_files[] = {
(defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG))
{
.name = "kmem.slabinfo",
.seq_show = memcg_slab_show,
.seq_show = mem_cgroup_slab_show,
},
#endif
{
Expand Down
5 changes: 0 additions & 5 deletions mm/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,11 +575,6 @@ static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node)

#endif

void *slab_start(struct seq_file *m, loff_t *pos);
void *slab_next(struct seq_file *m, void *p, loff_t *pos);
void slab_stop(struct seq_file *m, void *p);
int memcg_slab_show(struct seq_file *m, void *p);

#if defined(CONFIG_SLAB) || defined(CONFIG_SLUB_DEBUG)
void dump_unreclaimable_slab(void);
#else
Expand Down
17 changes: 3 additions & 14 deletions mm/slab_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,18 +1039,18 @@ static void print_slabinfo_header(struct seq_file *m)
seq_putc(m, '\n');
}

void *slab_start(struct seq_file *m, loff_t *pos)
static void *slab_start(struct seq_file *m, loff_t *pos)
{
mutex_lock(&slab_mutex);
return seq_list_start(&slab_caches, *pos);
}

void *slab_next(struct seq_file *m, void *p, loff_t *pos)
static void *slab_next(struct seq_file *m, void *p, loff_t *pos)
{
return seq_list_next(p, &slab_caches, pos);
}

void slab_stop(struct seq_file *m, void *p)
static void slab_stop(struct seq_file *m, void *p)
{
mutex_unlock(&slab_mutex);
}
Expand Down Expand Up @@ -1118,17 +1118,6 @@ void dump_unreclaimable_slab(void)
mutex_unlock(&slab_mutex);
}

#if defined(CONFIG_MEMCG_KMEM)
int memcg_slab_show(struct seq_file *m, void *p)
{
/*
* Deprecated.
* Please, take a look at tools/cgroup/slabinfo.py .
*/
return 0;
}
#endif

/*
* slabinfo_op - iterator that generates /proc/slabinfo
*
Expand Down

0 comments on commit c29b5b3

Please sign in to comment.