Re: [PATCH RFC 2/4] mm, slab: move slab_memcg hooks to mm/memcontrol.c

Matthew Wilcox
2024-03-12T19:33:09Z

On Tue, Mar 12, 2024 at 11:56:31AM -0700, Roman Gushchin wrote:
> On Fri, Mar 01, 2024 at 06:07:09PM +0100, Vlastimil Babka wrote:
> > The hooks make multiple calls to functions in mm/memcontrol.c, including
> > to th current_obj_cgroup() marked __always_inline. It might be faster to
> > make a single call to the hook in mm/memcontrol.c instead. The hooks
> > also don't use almost anything from mm/slub.c. obj_full_size() can move
> > with the hooks and cache_vmstat_idx() to the internal mm/slab.h
> >
> > Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> > ---
> > mm/memcontrol.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > mm/slab.h | 10 ++++++
> > mm/slub.c | 100 --------------------------------------------------------
> > 3 files changed, 100 insertions(+), 100 deletions(-)
>
> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
>
> Btw, even before your change:
> $ cat mm/memcontrol.c | wc -l
> 8318
> so I wonder if soon we might want to split it into some smaller parts.

If we are going to split it, perhaps a mm/memcg-v1.c would make sense,
because I certainly don't have a good idea about what's v1 and what's
v2. And maybe we could even conditionally compile the v1 file ;-)