Acclaim: Adaptive Memory Reclaim to Improve User Experience in Android Systems

Yu Liang, Jinheng Li, Rachata Ausavarungnirun, Riwei Pan, Liang Shi, Tei-Wei Kuo, Chun Jason XueUSENIX ATC 2020 · OpenReview

TL;DR

Android's memory management, inherited from Linux servers, struggles with mobile workloads, leading to performance issues like app slowdowns and crashes. This paper introduces Acclaim, a novel memory reclaim scheme that prioritizes foreground apps and intelligently adapts reclaim behavior, significantly improving user experience with minimal overhead.

What Problem Does This Paper Address?

Modern smartphones, despite their increasing power, often suffer from performance degradation and unexpected app closures. This is largely due to the memory management system, which is based on Linux kernels designed for desktops and servers. This "one-size-fits-all" approach fails to account for the unique characteristics of mobile device workloads, such as frequent, small memory allocations and the critical importance of foreground application responsiveness. Specifically, the paper identifies two major culprits:

  • Page Re-faults: When a page of memory that was recently evicted is needed again, the system has to fetch it from slower storage, causing significant delays. This is exacerbated by background apps consuming memory that foreground apps might need soon.
  • Direct Reclaims: When the system is critically low on memory, it's forced to immediately reclaim pages, often by flushing dirty data to storage. This synchronous process pauses application execution, leading to noticeable slowdowns and a poor user experience.

The paper argues that existing solutions, like optimizing eviction algorithms or simply increasing RAM, are insufficient. A more intelligent approach to memory reclaim is needed to bridge the gap between server-centric designs and mobile realities.

Methods

Acclaim is a two-pronged approach designed to address the identified problems:

  • Foreground Aware Eviction (FAE): This component prioritizes foreground applications by actively reclaiming memory from background applications. It achieves this by lowering the priority of background app pages in the LRU (Least Recently Used) lists, making them more likely to be evicted. This ensures that memory is preferentially kept for apps the user is actively interacting with. FAE is designed to be compatible with the existing Low Memory Killer (LMK) and can be configured to exempt certain critical background applications (e.g., music players).
  • Lightweight Prediction-Based Reclaim Scheme (LWP): This component aims to reduce the latency and impact of background memory reclaim. It uses a lightweight, lock-free sliding window predictor to forecast future memory allocation workloads (both size and frequency). Based on these predictions, LWP dynamically tunes the size and amount of background reclaims. This prevents overly aggressive or insufficient reclaiming, striking a balance to avoid both excessive page re-faults and the need for direct reclaims.

Datasets

The paper does not explicitly mention training datasets. For evaluation, the authors used:

  • Real-world mobile devices: Experiments were conducted on Huawei P9 smartphones with 3GB RAM running Android 7.0. To simulate memory constraints, they also used a 2.5GB RAM configuration achieved with memtester.
  • Popular Android applications: A diverse set of applications including Facebook, Twitter, Instagram, WhatsApp, Chrome, Firefox, and games like Angry Birds were used to simulate realistic usage scenarios.
  • Controlled experiments: The authors designed experiments to isolate the effects of foreground/background application counts and available memory on page re-faults and direct reclaims.

Key Insights and Ideas

  • Mobile workloads are fundamentally different: The paper strongly emphasizes that memory management strategies optimized for servers are ill-suited for the dynamic and interactive nature of mobile devices.
  • Background apps are a major culprit: Even when not actively used, background applications consume significant memory resources, leading to page re-faults and increased pressure on foreground apps.
  • Direct reclaim is a performance killer: While a necessary fallback, direct reclaims are orders of magnitude slower than background reclaims and severely degrade user experience. Minimizing their occurrence is paramount.
  • Prioritizing foreground is key: The user experience is directly tied to the responsiveness of foreground applications. Acclaim's FAE component directly addresses this by shifting memory pressure away from foreground apps.
  • Predictive memory management pays off: LWP's ability to predict future memory needs allows for more intelligent and less disruptive memory reclaim, avoiding the pitfalls of fixed reclaim policies.

Key Results

  • Reduced Page Re-faults: Acclaim significantly reduces page re-faults for foreground applications. For the AngryBird benchmark, it achieved a reduction of up to 58.8% in launch latency.
  • Reduced Direct Reclaims: The system effectively minimizes direct reclaims. In experiments, direct reclaims were reduced by up to 70% across the OS.
  • Improved Application Launch Times: Acclaim shows notable improvements in application launch latency, especially when multiple memory-hungry background applications are present. Reductions of up to 58.8% were observed for apps like CandyCrush.
  • Minimal Performance Overhead: The proposed Acclaim scheme introduces only a trivial performance overhead, with memory overhead being around 0.1% of total memory capacity.
  • Balanced Impact: While Acclaim generally improves performance, it can have a minor negative impact on applications that heavily share files with background apps (e.g., Chrome). However, this can be mitigated with techniques like mlock.

Limitations and Future Work

  • UID Limitation: FAE currently supports a maximum of 256 unique UIDs, which is an implementation limitation.
  • Prediction Accuracy: LWP's performance can be affected by the accuracy of its prediction, especially during sudden, unpredictable changes in application workloads.
  • Shared File Impact: Acclaim can negatively impact applications that share files with background apps, though this is acknowledged and potential mitigation strategies are mentioned.

Future work could explore extending the UID support, improving prediction accuracy for more dynamic workloads, and further optimizing the interaction between FAE and LWP for even greater efficiency. The authors also suggest exploring application prediction techniques to further eliminate any potential penalties from FAE.

Summary updated

BibTeX
@inproceedings{liang2020acclaim,
  author = {Yu Liang and Jinheng Li and Rachata Ausavarungnirun and Riwei Pan and Liang Shi and Tei-Wei Kuo and Chun Jason Xue},
  title = {{Acclaim: Adaptive Memory Reclaim to Improve User Experience in Android Systems}},
  booktitle = {USENIX ATC},
  year = {2020},
  url = {https://openreview.net/forum?id=cTPjoE2CPA},
}
Figure