Commit 34679d7eac9ecc20face093db9aa610f1e9c893a
Committed by
Linus Torvalds
1 parent
7bf02ea22c
Exists in
master
and in
7 other branches
mmap: add alignment for some variables
Make some variables have correct alignment/section to avoid cache issue. In a workload which heavily does mmap/munmap, the variables will be used frequently. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Rik van Riel <riel@redhat.com> Cc: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff
mm/mmap.c
... | ... | @@ -84,10 +84,14 @@ |
84 | 84 | } |
85 | 85 | EXPORT_SYMBOL(vm_get_page_prot); |
86 | 86 | |
87 | -int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ | |
88 | -int sysctl_overcommit_ratio = 50; /* default is 50% */ | |
87 | +int sysctl_overcommit_memory __read_mostly = OVERCOMMIT_GUESS; /* heuristic overcommit */ | |
88 | +int sysctl_overcommit_ratio __read_mostly = 50; /* default is 50% */ | |
89 | 89 | int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; |
90 | -struct percpu_counter vm_committed_as; | |
90 | +/* | |
91 | + * Make sure vm_committed_as in one cacheline and not cacheline shared with | |
92 | + * other variables. It can be updated by several CPUs frequently. | |
93 | + */ | |
94 | +struct percpu_counter vm_committed_as ____cacheline_aligned_in_smp; | |
91 | 95 | |
92 | 96 | /* |
93 | 97 | * Check that a process has enough memory to allocate a new virtual |