On Mon 24-06-24 17:58:53, Roman Gushchin wrote: > This patch introduces the mm/memcontrol-v1.c source file which will be used for > all legacy (cgroup v1) memory cgroup code. It also introduces mm/memcontrol-v1.h > to keep declarations shared between mm/memcontrol.c and mm/memcontrol-v1.c. > > As of now, let's compile it if CONFIG_MEMCG is set, similar to mm/memcontrol.c. > Later on it can be switched to use a separate config option, so that the legacy > code won't be compiled if not required. I do not feel strongly about that but wouldn't having the new config here already make it easier to test? > Signed-off-by: Roman Gushchin <roman.gushchin@xxxxxxxxx> Anyway Acked-by: Michal Hocko <mhocko@xxxxxxxx> > --- > mm/Makefile | 3 ++- > mm/memcontrol-v1.c | 3 +++ > mm/memcontrol-v1.h | 7 +++++++ > 3 files changed, 12 insertions(+), 1 deletion(-) > create mode 100644 mm/memcontrol-v1.c > create mode 100644 mm/memcontrol-v1.h > > diff --git a/mm/Makefile b/mm/Makefile > index 8fb85acda1b1..124d4dea2035 100644 > --- a/mm/Makefile > +++ b/mm/Makefile > @@ -26,6 +26,7 @@ KCOV_INSTRUMENT_page_alloc.o := n > KCOV_INSTRUMENT_debug-pagealloc.o := n > KCOV_INSTRUMENT_kmemleak.o := n > KCOV_INSTRUMENT_memcontrol.o := n > +KCOV_INSTRUMENT_memcontrol-v1.o := n > KCOV_INSTRUMENT_mmzone.o := n > KCOV_INSTRUMENT_vmstat.o := n > KCOV_INSTRUMENT_failslab.o := n > @@ -95,7 +96,7 @@ obj-$(CONFIG_NUMA) += memory-tiers.o > obj-$(CONFIG_DEVICE_MIGRATION) += migrate_device.o > obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += huge_memory.o khugepaged.o > obj-$(CONFIG_PAGE_COUNTER) += page_counter.o > -obj-$(CONFIG_MEMCG) += memcontrol.o vmpressure.o > +obj-$(CONFIG_MEMCG) += memcontrol.o memcontrol-v1.o vmpressure.o > ifdef CONFIG_SWAP > obj-$(CONFIG_MEMCG) += swap_cgroup.o > endif > diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c > new file mode 100644 > index 000000000000..a941446ba575 > --- /dev/null > +++ b/mm/memcontrol-v1.c > @@ -0,0 +1,3 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > + > +#include "memcontrol-v1.h" > diff --git a/mm/memcontrol-v1.h b/mm/memcontrol-v1.h > new file mode 100644 > index 000000000000..7c5f094755ff > --- /dev/null > +++ b/mm/memcontrol-v1.h > @@ -0,0 +1,7 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > + > +#ifndef __MM_MEMCONTROL_V1_H > +#define __MM_MEMCONTROL_V1_H > + > + > +#endif /* __MM_MEMCONTROL_V1_H */ > -- > 2.45.2 -- Michal Hocko SUSE Labs