Add -XX:MadviseRandomAccess option
If enabled, ART will advise random access to the kernel for files
that are thought to have such access patterns.
Bug: 67772594
Test: verify that -XX:MadviseRandomAccess:true is passed to runtime init
(cherry picked from commit 087f2046dfdf41646c740a05004b4d40cbd99b11)
Change-Id: I76a5f62846d563a4f2cf25e47dbd320464aee8c1
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 399e1c1..9f79a01 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -682,6 +682,12 @@
return result;
}
+ // Whether or not we use MADV_RANDOM on files that are thought to have random access patterns.
+ // This is beneficial for low RAM devices since it reduces page cache thrashing.
+ bool MAdviseRandomAccess() const {
+ return madvise_random_access_;
+ }
+
private:
static void InitPlatformSignalHandlers();
@@ -916,6 +922,10 @@
// Whether or not we are on a low RAM device.
bool is_low_memory_mode_;
+ // Whether or not we use MADV_RANDOM on files that are thought to have random access patterns.
+ // This is beneficial for low RAM devices since it reduces page cache thrashing.
+ bool madvise_random_access_;
+
// Whether the application should run in safe mode, that is, interpreter only.
bool safe_mode_;