diff mbox series

[v1,01/14] mm: memcg: introduce memcontrol-v1.c

Message ID 20240528202101.3099300-2-roman.gushchin@linux.dev (mailing list archive)
State New
Headers show
Series mm: memcg: separate legacy cgroup v1 code and put under config option | expand

Commit Message

Roman Gushchin May 28, 2024, 8:20 p.m. UTC
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.

Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
---
 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

Comments

Shakeel Butt June 1, 2024, 6:42 a.m. UTC | #1
On Tue, May 28, 2024 at 01:20:53PM GMT, 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.
> 
> Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>

Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Roman Gushchin June 4, 2024, 3:58 a.m. UTC | #2
On Fri, May 31, 2024 at 11:42:26PM -0700, Shakeel Butt wrote:
> On Tue, May 28, 2024 at 01:20:53PM GMT, 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.
> > 
> > Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> 
> Acked-by: Shakeel Butt <shakeel.butt@linux.dev>

Thank you for reviewing the series!
diff mbox series

Patch

diff --git a/mm/Makefile b/mm/Makefile
index 8fb85acda1b1c..124d4dea20351 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 0000000000000..a941446ba575b
--- /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 0000000000000..7c5f094755ff8
--- /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 */