Skip to content

Commit 6df1323

Browse files
rgushchinakpm00
authored andcommitted
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]>
1 parent 9fa001c commit 6df1323

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/linux/memcontrol.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,16 @@ struct mem_cgroup_per_node {
9595
#ifdef CONFIG_MEMCG_V1
9696
/*
9797
* Memcg-v1 only stuff in middle as buffer between read mostly fields
98-
* and update often fields to avoid false sharing. Once v1 stuff is
99-
* moved in a separate struct, an explicit padding is needed.
98+
* and update often fields to avoid false sharing. If v1 stuff is
99+
* not present, an explicit padding is needed.
100100
*/
101101

102102
struct rb_node tree_node; /* RB tree node */
103103
unsigned long usage_in_excess;/* Set to the value by which */
104104
/* the soft limit is exceeded*/
105105
bool on_tree;
106+
#else
107+
CACHELINE_PADDING(_pad1_);
106108
#endif
107109

108110
/* Fields which get updated often at the end. */

0 commit comments

Comments
 (0)