summaryrefslogtreecommitdiff
path: root/include/linux/page_counter.h
diff options
context:
space:
mode:
authorShakeel Butt <shakeelb@google.com>2022-08-26 23:06:42 +0000
committerAndrew Morton <akpm@linux-foundation.org>2022-09-26 19:46:29 -0700
commite6ad640bc404eb298dd1880113131768ddf5c6a8 (patch)
treef72c01caf19e88d74482af862b9378f6f19893b9 /include/linux/page_counter.h
parent974f4367dd315acc15ad4a6453f8304aea60dfbd (diff)
mm: deduplicate cacheline padding code
There are three users (mmzone.h, memcontrol.h, page_counter.h) using similar code for forcing cacheline padding between fields of different structures. Dedup that code. Link: https://lkml.kernel.org/r/20220826230642.566725-1-shakeelb@google.com Signed-off-by: Shakeel Butt <shakeelb@google.com> Suggested-by: Feng Tang <feng.tang@intel.com> Reviewed-by: Feng Tang <feng.tang@intel.com> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/page_counter.h')
-rw-r--r--include/linux/page_counter.h13
1 files changed, 2 insertions, 11 deletions
diff --git a/include/linux/page_counter.h b/include/linux/page_counter.h
index 78a1c934e416..c141ea9a95ef 100644
--- a/include/linux/page_counter.h
+++ b/include/linux/page_counter.h
@@ -7,22 +7,13 @@
#include <linux/kernel.h>
#include <asm/page.h>
-#if defined(CONFIG_SMP)
-struct pc_padding {
- char x[0];
-} ____cacheline_internodealigned_in_smp;
-#define PC_PADDING(name) struct pc_padding name
-#else
-#define PC_PADDING(name)
-#endif
-
struct page_counter {
/*
* Make sure 'usage' does not share cacheline with any other field. The
* memcg->memory.usage is a hot member of struct mem_cgroup.
*/
atomic_long_t usage;
- PC_PADDING(_pad1_);
+ CACHELINE_PADDING(_pad1_);
/* effective memory.min and memory.min usage tracking */
unsigned long emin;
@@ -38,7 +29,7 @@ struct page_counter {
unsigned long failcnt;
/* Keep all the read most fields in a separete cacheline. */
- PC_PADDING(_pad2_);
+ CACHELINE_PADDING(_pad2_);
unsigned long min;
unsigned long low;