diff mbox series

[v1,8/9] mm: memcg: put struct task_struct::memcg_in_oom under CONFIG_MEMCG_V1

Message ID 20240628210317.272856-9-roman.gushchin@linux.dev (mailing list archive)
State New
Headers show
Series mm: memcg: put cgroup v1-specific memcg data under CONFIG_MEMCG_V1 | expand

Commit Message

Roman Gushchin June 28, 2024, 9:03 p.m. UTC
The memcg_in_oom field of the struct task_struct is not used by
the cgroup v2's memory controller, so it can be happily compiled out
if CONFIG_MEMCG_V1 is not set.

Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
---
 include/linux/sched.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Shakeel Butt June 29, 2024, 12:53 a.m. UTC | #1
On Fri, Jun 28, 2024 at 09:03:16PM GMT, Roman Gushchin wrote:
> The memcg_in_oom field of the struct task_struct is not used by
> the cgroup v2's memory controller, so it can be happily compiled out
> if CONFIG_MEMCG_V1 is not set.
> 
> Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>

Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
diff mbox series

Patch

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 61591ac6eab6..2a16023e8620 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1447,9 +1447,11 @@  struct task_struct {
 	unsigned int			kcov_softirq;
 #endif
 
-#ifdef CONFIG_MEMCG
+#ifdef CONFIG_MEMCG_V1
 	struct mem_cgroup		*memcg_in_oom;
+#endif
 
+#ifdef CONFIG_MEMCG
 	/* Number of pages to reclaim on returning to userland: */
 	unsigned int			memcg_nr_pages_over_high;