aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gushchin <[email protected]>2024-07-01 18:59:32 +0000
committerAndrew Morton <[email protected]>2024-07-10 12:14:54 -0700
commit6df13230b612af81ce04f20bb37a02e58ef71925 (patch)
tree6eb98f72f91549532fff2c387e40d7c7a9591318
parent9fa001cf3bb0598aad09d15b2896f7db9ef87637 (diff)
mm: memcg: add cache line padding to mem_cgroup_per_node
Memcg v1-specific fields serve a buffer function between read-mostly and update often parts of the mem_cgroup_per_node structure. If CONFIG_MEMCG_V1 is not set and these fields are not present, an explicit cacheline padding is needed. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Roman Gushchin <[email protected]> Suggested-by: Shakeel Butt <[email protected]> Acked-by: Shakeel Butt <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Muchun Song <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--include/linux/memcontrol.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 8b5b3ddeba05..60418934827c 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -95,14 +95,16 @@ struct mem_cgroup_per_node {
#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
- * moved in a separate struct, an explicit padding is needed.
+ * and update often fields to avoid false sharing. If v1 stuff is
+ * not present, an explicit padding is needed.
*/
struct rb_node tree_node; /* RB tree node */
unsigned long usage_in_excess;/* Set to the value by which */
/* the soft limit is exceeded*/
bool on_tree;
+#else
+ CACHELINE_PADDING(_pad1_);
#endif
/* Fields which get updated often at the end. */