Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Be sure to add '#define MADV_MERGEABLE 12' to bionic/libc/include/sys/mman.h so we can have a central place for this parse the process memory map and inform madvise common HEAP/Stack regions on fork from zygote These then can be used by the kernel KSM module to re-join (copy on write) pages between the various dalvik processes. As is on a fully loaded system you can expect ~12MB to be indicated to be scanned by KSM.. of this 10-15% will be saved; as such a recommend a very slow scan until as any logic to stop scanning while sleeping will require another process and remove all memory savings provided by this logic. To activate on a KSM kernel (2min for full scan of ~16m and 1%CPU): echo 4000 > /sys/kernel/mm/ksm/sleep_millisecs echo 128 > /sys/kernel/mm/ksm/pages_to_scan echo 1 > /sys/kernel/mm/ksm/run Newer kernels only require the last line. In future additional memory regions and kernel logic may improve this. Change-Id: I271cbee74a1f02a89c34c6ee9006a4ea81360154
- Loading branch information