From 83e7deb46b9385af99a21cd261bc939c83b6f682 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 1 Jul 2021 15:16:40 -0700 Subject: [PATCH] Allow the kernel to upgrade ASYNC mode processes to SYNC mode. On devices where the performance of ASYNC mode is similar to SYNC mode on certain CPUs, OEMs may choose to configure the kernel to prefer SYNC mode on those CPUs by writing the value "sync" to the sysfs node: /sys/devices/system/cpu/cpu/mte_tcf_preferred The kernel will only respect the per-CPU preference if the user program allows this by specifying the preferred mode as a member of a set of allowed modes. Since only kernels with r.android.com/1754670 support specifying multiple modes, fall back to trying to specify a single mode if that doesn't work. Bug: 189966263 Change-Id: Ie7ada3b073178b7967f0819cbdadc2d8e3a2c648 --- core/jni/com_android_internal_os_Zygote.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp index 96fc0866a3452..f2c177c76ffa1 100644 --- a/core/jni/com_android_internal_os_Zygote.cpp +++ b/core/jni/com_android_internal_os_Zygote.cpp @@ -2532,6 +2532,7 @@ static jint com_android_internal_os_Zygote_nativeCurrentTaggingLevel(JNIEnv* env case PR_MTE_TCF_SYNC: return MEMORY_TAG_LEVEL_SYNC; case PR_MTE_TCF_ASYNC: + case PR_MTE_TCF_ASYNC | PR_MTE_TCF_SYNC: return MEMORY_TAG_LEVEL_ASYNC; default: ALOGE("Unknown memory tagging level: %i", level);