diff options
author | 2020-05-13 17:08:43 +0000 | |
---|---|---|
committer | 2020-05-13 19:34:11 +0000 | |
commit | 58520dfba31d6eeef75f5babff15e09aa28e5db8 (patch) | |
tree | eb09e871c318fa9a01923e9afd31f70bdbb5e468 /libartbase/base/utils.cc | |
parent | bc89ed42d6128c27819e5403f6ceca5c18892e23 (diff) |
Revert "Use MADV_FREE to reclaim pages of freed regions"
This reverts commit 315f1b21a51a67e5d9c9ec3a04f1887931061e10.
Reason for revert: Regression in PSS (b/155678984). Also MPTS test report a low hit ratio (20%), which doesn't justify the change, at least in the current format. A workaround will be to bring back marking pages back and only madv_free first few regions which are expected to be allocated soon. The rest of the regions should probably be reclaimed with MADV_DONTNEED. Also, for a GC happening when the app is in background should probably reclaim all regions with MADV_DONTNEED.
Test: art/test/testrunner/testrunner.py
Bug: 155678984
Bug: 74447417
Bug: 140130889
Change-Id: I3c4bc4648a3b12062957a51ee716742eb9944747
Diffstat (limited to 'libartbase/base/utils.cc')
-rw-r--r-- | libartbase/base/utils.cc | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/libartbase/base/utils.cc b/libartbase/base/utils.cc index 4e8d306928..19311b3ded 100644 --- a/libartbase/base/utils.cc +++ b/libartbase/base/utils.cc @@ -156,33 +156,6 @@ bool FlushCpuCaches(void* begin, void* end) { #endif -// On non-linux builds assume that the kernel version is lower than required. -#if defined(__linux__) -std::pair<int, int> GetKernelVersion() { - struct utsname uts; - int major, minor; - CHECK_EQ(uname(&uts), 0); - CHECK_EQ(strcmp(uts.sysname, "Linux"), 0); - CHECK_EQ(sscanf(uts.release, "%d.%d", &major, &minor), 2); - return std::pair(major, minor); -} - -bool KernelVersionLower(int required_major, int required_minor) { - // static (major, minor) pair as it never changes during runtime. - static std::pair<int, int> kernel_version = GetKernelVersion(); - if (kernel_version.first < required_major - || (kernel_version.first == required_major && kernel_version.second < required_minor)) { - return true; - } else { - return false; - } -} -#else -bool KernelVersionLower(int required_major ATTRIBUTE_UNUSED, int required_minor ATTRIBUTE_UNUSED) { - return true; -} -#endif - bool CacheOperationsMaySegFault() { #if defined(__linux__) && defined(__aarch64__) // Avoid issue on older ARM64 kernels where data cache operations could be classified as writes @@ -192,7 +165,14 @@ bool CacheOperationsMaySegFault() { // // This behaviour means we should avoid the dual view JIT on the device. This is just // an issue when running tests on devices that have an old kernel. - if (KernelVersionLower(3, 12)) { + static constexpr int kRequiredMajor = 3; + static constexpr int kRequiredMinor = 12; + struct utsname uts; + int major, minor; + if (uname(&uts) != 0 || + strcmp(uts.sysname, "Linux") != 0 || + sscanf(uts.release, "%d.%d", &major, &minor) != 2 || + (major < kRequiredMajor || (major == kRequiredMajor && minor < kRequiredMinor))) { return true; } #endif |