Enhancing Application Performance by Memory Partitioning in Android Platforms
EEnhancing Application Performance by MemoryPartitioning in Android Platforms
Geunsik Lim ∗ , Changwoo Min † and Young Ik Eom ‡ Sungkyunkwan University, Korea ∗†‡
Samsung Electronics, Korea ∗† { leemgs ∗ , multics69 † , yieom ‡ } @skku.edu, { geunsik.lim ∗ , changwoo.min † } @samsung.com Abstract —This paper suggests a new memory partitioningscheme that can enhance process lifecycle, while avoiding LowMemory Killer and Out-of-Memory Killer operations on mobiledevices. Our proposed scheme offers the complete concept ofvirtual memory nodes in operating systems of Android devices.
I. I
NTRODUCTION
Recent mobile phone users can use not only the built-inapplications that the manufacturers included into the mobilephone, but also the third-party applications obtained fromvarious app-markets. In these systems, due to the memoryconsumption of the third-party applications, there are frequentsituations that the available memory space is insufficient to runthose applications efficiently. Especially, in low-end mobiledevices that do not have sufficient memory capacity, memoryshortage may occur more frequently.In this paper, we introduce a new memory partitioningscheme to get enhanced application performance during pro-cess lifecycle [1], while avoiding Low Memory Killer (LMK)and Out-of-Memory Killer (OOMK) operations on mobile de-vices. We propose a complete memory partitioning frameworkat the operating system level.The rest of this paper is organized as follows. In SectionII, several technical issues on process lifecycle are described.The new memory partitioning scheme for improving processlifecycle is suggested in Section III. Section IV shows theevaluation results of the proposed scheme. Finally, Section Vconcludes the paper.II. M
EMORY M ANAGEMENT IN A NDROID P LATFORM
The operating system generally supports page reclamation[2], swap in/out [3], cgroups [4], and OOMK [5] to settle thememory shortage problem.The page reclamation mechanism is useful to obtain avail-able memory in the system. However, the mechanism alwaysfinds victim processes heuristically among the processes in thememory.The mobile device manufacturers do not use the swapin/out technology in their commercial products because of thethroughput issues of their applications.
This work was supported by the IT R&D program of MKE/KEIT[10041244, SmartTV 2.0 Software Platform]. This research was supported byBasic Science Research Program through the National Research Foundationof Korea(NRF) funded by the Ministry of Education, Science and Technology[2011-0025971].
Although the cgroups provides a mechanism for aggre-gating/partitioning the set of tasks into several hierarchicalgroups, this mechanism does not prevent memory fragmenta-tions because of the logical memory partitioning with privateLRU of structure page cgroup per page.The OOMK attempts to recover memory shortage from theOOM condition by killing low-priority processes [2] [5] whichwill most likely be the first victim. But, the operation of theOOMK results in the performance damage of new applicationsbecause of the thrashing occurred due to the limited memoryresource of the mobile devices.Android platform supports process lifecycle mechanism toclassify the processes based on the importance of the processesso that new applications can get the needed memory properlyeven when it reaches the situation of memory shortage. Itcontrols the memory usage of each application via user-space components (Activity manager, Dalvik) and kernel-space components (LMK, OOMK) [1] [5] to secure availablememory stably.Even under the system with large memory, memory shortagecan happen when high-capacity and high-performance userapplications come to run. Therefore, it is very important tosecure as large available memory as possible. In Section III,we will describe our approach to solve this memory shortageproblem on mobile devices.III. V
IRTUAL NODES TO AVOID
LMK
OPERATIONS
Figure 1 shows the overall architecture of the new memorypartitioning technique for improving process lifecycle of theAndroid platform with the physically limited memory space.Our proposed memory partitioning technique mainly consistsof three components as follows:1) vnode setup memblock : sets up a memory node virtu-ally from the start address to the end address.2) vnode generation : generates a physical memory con-figuration that maps between the virtual node and thephysical memory address, and determines the size ofthe physical distance table.a) virtual node is a communication channel for log-ically partitioned memory access between the vir-tual memory and the physical memory.b) physical distance table is a map to get the physi-cally separated memory block.3) vnode set cpumask : allocates specific CPU masks formapping between each CPU and each virtual node. a r X i v : . [ c s . O S ] J a n ig. 1. The architecture of proposed memory partitioning Our design has two advantages in Android-based mobiledevices: (1) limiting the memory consumption of untrust-worthy applications by partitioning the memory space intotwo areas, virtual node (VNODE) 0 for reliable applications(official market) and virtual node (VNODE) 1 for unreliableapplications (black market), (2) avoiding LMK and OOMKoperations which happen under physical memory shortage.The arrows of Figure 1 represent the operations on the CPUand memory when an administrator sets the virtual memorynodes of the operating system from a physical memory onAndroid devices. For example, we run some critical appli-cations only in VNODE 0. Also, we run other applicationsin VNODE 1. Through this approach, the operating systemmanages applications to avoid reaching the memory shortageeven in a long running system.Our memory partitioning scheme prevents an applicationfrom exhausting the entire memory by executing criticalapplications only in VNODE 0. Accordingly, these critical ap-plications will stay in the memory of VNODE 0 continuouslyuntil a user terminates the critical application.The key idea is that non-critical applications run in thephysically partitioned specific memory area. This operationhelps the system to avoid reaching no free memory. Thesenon-critical applications only return their allocated memorywith the page reclamation algorithm of Linux.The proposed system completely offers virtual memorynodes at the operating system level for enhanced processlifecycle in Android devices. This equipment supports scalablesystem infrastructure as follows: • Virtually separated memory space. • Operating system level memory isolation. • Advanced page reclamation based on virtual nodes. • Memory controller interface at boot time.IV. RESULTSWe ported the latest
Android Ice Cream Sandwich 4.0.4 and
Busybox 1.18 to Samsung SENS R60+ (CPU: Intel Core2Duo,MEM: DDR2 2G) laptop to verify that our technical approachcan be effective on the Android mobile platform. We alsobooted the
Android Ice Cream Sandwich including our newmemory partitioning scheme based on Linux kernel 3.0 asa test bed for the Android tablet platform. We configured thesystem by creating two virtual memory nodes in different size, “VNODE 0 of 1.5 GB and VNODE 1 of 0.5 GB” . Fig. 2. The available memory result with virtual memory node
We evaluated and compared the memory consumption of theexisting approach ( before ) and the proposed approach ( after )when we executed the sequential file I/O operation with theraw contents of the size of 1.5 GB into VNODE 1 for 2 days.Figure 2 shows the available memory size, the result of LMK,and the status of the OOMK after running the sequential fileI/O operations.From our experiments, we gained the additional free mem-ory of 670 MB and the reduced
Phone application executiontime of 1,015 milliseconds over the existing systems. Since thetest workload on VNODE 1 can use only 0.5 GB memory,Linux kernel executes many page reclamation operations inVNODE 1. Through our approach, the proposed system doesnot meet the operation of LMK and/or OOMK which oper-ates on free memory shortage, 335 MB in our experimentalenvironment. The frequencies of the execution of memorykillers, both LMK and OOMK, were improved dramaticallyafter adjusting the virtual nodes based on the new memorypartitioning scheme. V. C
ONCLUSION
We proposed a virtual memory node technique for memorypartitioning. It focuses on the page reclamation operation ofnon-critical applications and the non-page reclamation opera-tion of critical applications. Also, our approach supports vir-tual memory isolation to separately run applications of blackmarkets and applications of official markets in the Androidplatform based on discontiguous memory access model. Theseapproaches prevent LMK and OOMK from killing processesbecause of the memory shortage of the system.In conclusion, our approach innovatively overcomes thepoor performance of applications incurred due to the oper-ations of LMK and OOMK, without any physical memoryextension. R
EFERENCES[1] Google, “Android Application’s Life Cycle (Process, Activity),” in http://developer.android.com/reference/android/app/Activity.html , 2008.[2] M. Gorman, “Understanding the Linux Virtual Memory Manager,” in
Prentice Hall Professional Technical Reference , March 2004.[3] N. Gupta, “Compcache; in-memory compressed swapping,” in http://lwn.net/Articles/334649/ , May 2009.[4] B. Singh, “Containers: Challenges with the memory resource controllerand its performance,” in
Linux Symposium , vol. 2, June 2007, pp. 209–222.[5] D. Rientjes, “OOM Killer Rewrite; When the Kernel Runs Out ofMemory,” in