diff options
author | Vitaly Vul <vitaly.vul@sonymobile.com> | 2015-09-24 14:28:59 +0200 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-11-20 09:16:59 -0800 |
commit | ee67dd75e215f88e5632c05c7e7e7c7d30910359 (patch) | |
tree | 90447b12715a95240614e440be8cbb7c42d191a1 /linker/linker_utils.cpp | |
parent | f30170dfa514266a0bf007091aa54a866920208c (diff) |
mmap: fix calculation of is_private_anonymous variable
Currently is_private_anonymous is calculated as true if _either_
MAP_PRIVATE or MAP_ANONYMOUS is set, which is a mistake.
According to Documentation/vm/ksm.txt, "KSM only merges anonymous
(private) pages, never pagecache (file) pages". MAP_PRIVATE can
still be set on file cache pages so in order to not redundantly
set MADV_MERGEABLE on pages that are not fitted for it, both
MAP_PRIVATE and MAP_ANONYMOUS should be set.
Along with this fix, add an extra check that the mapped page is
not a stack page before setting MADV_MERGEABLE for it. Stack pages
change too quickly and always end up in KSM 'page_volatile' list.
Change-Id: If4954142852f17cc61f02985ea1cb625a7f3dec6
Diffstat (limited to 'linker/linker_utils.cpp')
0 files changed, 0 insertions, 0 deletions