[RFC] Task migration in memory cgroup is too heavy in Android

44 views
Skip to first unread message

Chintan Pandya

unread,
Jan 28, 2015, 8:52:38 AM1/28/15
to android...@googlegroups.com
Android presently uses memory cgroups for more swapping of cached apps. But when we enable memory cgroup from kernel, we see user experience is sluggish. Digging more into this, I found that, most of the time spent by CPU is on charge migration from one cgroup to another. In addition, the design of charge migration is not meant for very frequent task migration across the cgroups (like what Android expects). Mem cgroup takes global lock and migrates one task completely. If there are n-tasks waiting to be migrated, n-th task will starve the most. Now, for each task, charge migration happens on per-page basis. So, if the app is in order of 40-50 MB, 10K page migration routines will be invoked for just one process.

Problem gets even worse in Android context. Android maintains 2 groups. root and sw. In simple words, root contains process of higher importance and sw contains mostly cached processes. Now, when one process comes to foreground from cached group, and in parallel some processes are migrated to sw group, memcgroup will exhaust and sometimes gives worst timing for the process coming to foreground. This hugely affects the user experience.

2 questions,

(1) Did anyone faced this issue ?
(2) If yes, any idea to resolve this ?
Reply all
Reply to author
Forward
0 new messages