diff mbox series

[v1,7/9] mm: memcg: guard memcg1-specific members of struct mem_cgroup_per_node

Message ID 20240628210317.272856-8-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
Put memcg1-specific members of struct mem_cgroup_per_node under the
CONFIG_MEMCG_V1 config option.

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

Comments

Shakeel Butt June 29, 2024, 12:52 a.m. UTC | #1
On Fri, Jun 28, 2024 at 09:03:15PM GMT, Roman Gushchin wrote:
> Put memcg1-specific members of struct mem_cgroup_per_node under the
> CONFIG_MEMCG_V1 config option.
> 
> Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> ---
>  include/linux/memcontrol.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 107b0c5d6eab..c7ef628ee882 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -92,6 +92,7 @@ struct mem_cgroup_per_node {
>  	struct lruvec_stats			*lruvec_stats;
>  	struct shrinker_info __rcu	*shrinker_info;
>  
> +#ifdef CONFIG_MEMCG_V1
>  	/*
>  	 * Memcg-v1 only stuff in middle as buffer between read mostly fields
>  	 * and update often fields to avoid false sharing. Once v1 stuff is
> @@ -102,6 +103,7 @@ struct mem_cgroup_per_node {
>  	unsigned long		usage_in_excess;/* Set to the value by which */
>  						/* the soft limit is exceeded*/
>  	bool			on_tree;

Here we definitely need a padding after the pointers and before the
lruvec. We can add a #else to the #ifdef CONFIG_MEMCG_V1 and put a
cacheline padding in it.

> +#endif
>  
>  	/* Fields which get updated often at the end. */
>  	struct lruvec		lruvec;
> -- 
> 2.45.2.803.g4e1b14247a-goog
>
Shakeel Butt July 3, 2024, 3:13 p.m. UTC | #2
On Fri, Jun 28, 2024 at 09:03:15PM GMT, Roman Gushchin wrote:
> Put memcg1-specific members of struct mem_cgroup_per_node under the
> CONFIG_MEMCG_V1 config option.
> 
> 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/memcontrol.h b/include/linux/memcontrol.h
index 107b0c5d6eab..c7ef628ee882 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -92,6 +92,7 @@  struct mem_cgroup_per_node {
 	struct lruvec_stats			*lruvec_stats;
 	struct shrinker_info __rcu	*shrinker_info;
 
+#ifdef CONFIG_MEMCG_V1
 	/*
 	 * Memcg-v1 only stuff in middle as buffer between read mostly fields
 	 * and update often fields to avoid false sharing. Once v1 stuff is
@@ -102,6 +103,7 @@  struct mem_cgroup_per_node {
 	unsigned long		usage_in_excess;/* Set to the value by which */
 						/* the soft limit is exceeded*/
 	bool			on_tree;
+#endif
 
 	/* Fields which get updated often at the end. */
 	struct lruvec		lruvec;