summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-07-21 20:52:56 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-07-21 20:52:56 +0000
commitdd63caa87807e6e1fb5cf73fa7f2c95a6d9a7484 (patch)
tree2e03ed8d08dec913e86a8fffbb7cd8e210c8c238
parent161c6435cd24ea71f9115faa9c453b24bd2f0a1a (diff)
parentb3666a84055a8a93d821584594e9de496f123bb5 (diff)
downloadart-android13-mainline-go-uwb-release.tar.gz
Snap for 8857240 from b3666a84055a8a93d821584594e9de496f123bb5 to mainline-go-uwb-releaseaml_go_uwb_330912000android13-mainline-go-uwb-release
Change-Id: I19fc52c6870164a08f4638e7f3c7a4e052c2355d
-rw-r--r--runtime/runtime.cc15
-rwxr-xr-xtest/utils/regen-test-files18
2 files changed, 22 insertions, 11 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 149c8a9c17..2de3eb5c74 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -178,6 +178,7 @@
#include "well_known_classes.h"
#ifdef ART_TARGET_ANDROID
+#include <android/api-level.h>
#include <android/set_abort_message.h>
#include "com_android_apex.h"
namespace apex = com::android::apex;
@@ -3358,13 +3359,21 @@ void Runtime::MadviseFileForRange(size_t madvise_size_limit_bytes,
const uint8_t* map_begin,
const uint8_t* map_end,
const std::string& file_name) {
+#ifdef ART_TARGET_ANDROID
// Short-circuit the madvise optimization for background processes. This
// avoids IO and memory contention with foreground processes, particularly
// those involving app startup.
- const Runtime* runtime = Runtime::Current();
- if (runtime != nullptr && !runtime->InJankPerceptibleProcessState()) {
- return;
+ // Note: We can only safely short-circuit the madvise on T+, as it requires
+ // the framework to always immediately notify ART of process states.
+ static const int kApiLevel = android_get_device_api_level();
+ const bool accurate_process_state_at_startup = kApiLevel >= __ANDROID_API_T__;
+ if (accurate_process_state_at_startup) {
+ const Runtime* runtime = Runtime::Current();
+ if (runtime != nullptr && !runtime->InJankPerceptibleProcessState()) {
+ return;
+ }
}
+#endif // ART_TARGET_ANDROID
// Ideal blockTransferSize for madvising files (128KiB)
static constexpr size_t kIdealIoTransferSizeBytes = 128*1024;
diff --git a/test/utils/regen-test-files b/test/utils/regen-test-files
index 237ec960d4..edf6dd127d 100755
--- a/test/utils/regen-test-files
+++ b/test/utils/regen-test-files
@@ -736,18 +736,11 @@ class Generator:
mts_test_shards = []
- # ART test (gtest & run-test) shard(s).
- # TODO: Also handle the case of gtests requiring root access to the device
- # (`art_gtest_eng_only_module_names`).
+ # ART run-tests shard(s).
art_run_test_module_names = [ART_RUN_TEST_MODULE_NAME_PREFIX + t for t in art_run_tests]
art_run_test_shards = split_list(art_run_test_module_names, NUM_MTS_ART_RUN_TEST_SHARDS)
for i in range(len(art_run_test_shards)):
art_tests_shard_i_tests = art_run_test_shards[i]
- # Append ART gtests to the last ART run-test shard for now.
- # If needed, consider moving them to their own shard to increase
- # the parallelization of code coverage runs.
- if i + 1 == len(art_run_test_shards):
- art_tests_shard_i_tests.extend(art_gtest_mts_user_module_names)
art_tests_shard_i = self.create_mts_test_shard(
"ART run-tests", art_tests_shard_i_tests, i, 2020,
["TODO(rpl): Find a way to express this list in a more concise fashion."])
@@ -775,6 +768,15 @@ class Generator:
other_cts_libcore_tests_shard_num, 2021)
mts_test_shards.append(other_cts_libcore_tests_shard)
+ # ART gtests shard.
+ # TODO: Also handle the case of gtests requiring root access to the device
+ # (`art_gtest_eng_only_module_names`).
+ art_gtests_shard_num = len(mts_test_shards)
+ art_gtests_shard_tests = art_gtest_mts_user_module_names
+ art_gtests_shard = self.create_mts_test_shard(
+ "ART gtests", art_gtests_shard_tests, art_gtests_shard_num, 2022)
+ mts_test_shards.append(art_gtests_shard)
+
for s in mts_test_shards:
s.regen_test_plan_file()
s.regen_test_list_file()