summaryrefslogtreecommitdiff
path: root/linker/linker_main.cpp
diff options
context:
space:
mode:
authorVic Yang <victoryang@google.com>2019-01-29 20:23:16 -0800
committerVic Yang <victoryang@google.com>2019-01-30 22:13:13 -0800
commitbb7e1236f3676baffd5953061154e9a3552317d7 (patch)
treea1ddb820db657e34a56e66dd81a0b04a46922673 /linker/linker_main.cpp
parent58dd1cbd7f2a0b8a779f2f43c45447cdccc09c3e (diff)
Purge linker block allocators before leaving linker
This is the second attempt to purge linker block allocators. Unlike the previously reverted change which purge allocators whenever all objects are freed, we only purge right before control leaves the linker. This limits the performance impact to one munmap() call per dlopen(), in most cases. Bug: 112073665 Test: Boot and check memory usage with 'showmap'. Test: Run camear cold start performance test. Change-Id: I02c7c44935f768e065fbe7ff0389a84bd44713f0
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r--linker/linker_main.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index b0c27dcd6..7486cd79b 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -503,6 +503,10 @@ static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load
fflush(stdout);
#endif
+ // We are about to hand control over to the executable loaded. We don't want
+ // to leave dirty pages behind unnecessarily.
+ purge_unused_memory();
+
ElfW(Addr) entry = exe_info.entry_point;
TRACE("[ Ready to execute \"%s\" @ %p ]", si->get_realpath(), reinterpret_cast<void*>(entry));
return entry;