New issue
Advanced search Search tips

Issue 853223 link

Starred by 3 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Investigate DEX file eviction consequences on jank

Project Member Reported by lizeb@chromium.org, Jun 15 2018

Issue description

On low-end devices, ART doesn't compile many methods (or none at all).

From oatdump on Gobo, Android Go:
# oatdump  --oat-file=/data/app/com.google.android.apps.chrome-.../oat/arm/base.vdex --header-only
[...]
dex2oat-cmdline = --zip-fd=8 --zip-location=base.apk --input-vdex-fd=-1 --output-vdex-fd=10 --oat-fd=9 --oat-location=/data/app/com.google.android.apps.chrome-787akXzqgh6j_C4FjLWDjA==/oat/arm/base.odex --instruction-set=arm --instruction-set-variant=cortex-a53 --instruction-set-features=default --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=quicken --swap-fd=11 --classpath-dir=/data/app/com.google.android.apps.chrome-787akXzqgh6j_C4FjLWDjA== --class-loader-context=PCL[]

The "quicken" compilation profile is used, which is (see https://source.android.com/devices/tech/dalvik/configure):
"quicken: run DEX code verification and optimize some DEX instructions to get better interpreter performance."

Indeed, the odex is small, whereas the vdex (DEX + verification metadata) is larger:

# ls -lh
-rw-r--r-- 1 system all_a84 296K 2018-06-13 14:46 base.odex
-rw-r--r-- 1 system all_a84 7.1M 2018-06-13 14:46 base.vdex

However, since the VDEX contains bytecode and not code, it's not mapped with executable permissions (from /proc/pid/smaps):

9726f000-97993000 r--s 00000000 fd:00 29083      /data/app/com.google.android.apps.chrome-787akXzqgh6j_C4FjLWDjA==/oat/arm/base.vdex
Size:               7312 kB
Rss:                3804 kB
Pss:                2734 kB
Shared_Clean:       2140 kB
Shared_Dirty:          0 kB
Private_Clean:      1664 kB
Private_Dirty:         0 kB
Referenced:         3048 kB
Anonymous:             0 kB
AnonHugePages:         0 kB
Swap:                  0 kB
PSwap:                 0 kB
SwapPss:               0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Locked:                0 kB
VmFlags: rd mr me ms 

This makes the VDEX file prone to eviction, and may create jank when Java code has to execute.


Using the script attached, we see after Chrome being in the background for a few minutes:
$ tools/android/native_lib_memory/odex_pss.py --chrome-package com.google.android.apps.chrome
Total PSS from code pages = 3664kB

And opening Chrome and focusing the omnibox:
$ tools/android/native_lib_memory/odex_pss.py --chrome-package com.google.android.apps.chrome
Total PSS from code pages = 5084kB
$ tools/android/native_lib_memory/odex_pss.py --chrome-package com.google.android.apps.chrome
Total PSS from code pages = 5600kB


This could be a cause of jank. Several potential solutions could be tested, provided that this is an issue:
- mprotect(PROT_EXEC) on the vdex area (making it harder to evict)
- madvise(WILL_NEED) when Chrome is resumed



 
odex_pss.py
1.7 KB View Download
Status: Untriaged (was: Available)
Available, but no owner or component? Please find a component, as no one will ever find this without one.

Sign in to add a comment