skip reading vmallocinfo if not needed

If kernel supports vmalloc memory accouting from /proc/meminfo
(https://patchwork.kernel.org/patch/10944111/)
it's pointless to parse /proc/vmallocinfo since it's too heavy

Bug: 136688885
Test: manual checking right vmalloc pages from meminfo
Test: manual checking check that never invokes ReadVmallocInfo if
      kernel supports vmalloc pages
Change-Id: I725ea1f8a0c4ab07e78893fdb39661a65eac39e6
Signed-off-by: Minchan Kim <minchan@google.com>
This commit is contained in:
Minchan Kim
2019-07-09 11:57:41 +09:00
committed by Thierry Strudel
parent 0e5c34bb38
commit 49813529f7

View File

@@ -575,7 +575,7 @@ static void android_os_Debug_getMemInfo(JNIEnv *env, jobject clazz, jlongArray o
if (outArray != NULL) {
outLen = MEMINFO_COUNT;
for (int i = 0; i < outLen; i++) {
if (i == MEMINFO_VMALLOC_USED) {
if (i == MEMINFO_VMALLOC_USED && mem[i] == 0) {
outArray[i] = smi.ReadVmallocInfo() / 1024;
continue;
}