TL;DR
Mobile app switching is slow, especially under memory pressure, due to inefficient demand paging. This paper introduces ASAP, an adaptive prepaging system that intelligently prefetches pages to significantly reduce app switch times by up to 28.3% on average, without requiring app modifications.
What Problem Does This Paper Address?
Modern smartphones are packed with features, leading to a constant demand for memory. When memory runs low, mobile operating systems often kill background applications to free up space. While this helps keep foreground apps running, it creates a significant delay when a user switches back to a previously killed app. This delay, known as "switch time," is exacerbated by the need to reload application data, either by decompressing swapped-out pages or fetching them from slower storage. Even with compression-based swap, the process of fetching pages on-demand (demand paging) is inefficient, wasting valuable CPU and disk bandwidth. This paper aims to tackle this user experience bottleneck by minimizing the slowdown caused by demand paging during app switches.
Methods
ASAP tackles the problem of slow app switching through an adaptive prepaging mechanism. The core idea is to predict which pages an application will need before it actually requests them and fetch them proactively. ASAP consists of two main components:
- Switch Footprint Estimator (SFE): This component is responsible for identifying the set of pages likely to be accessed during an app switch. It uses different strategies for file-backed pages and anonymous pages:
- File-backed pages: These pages tend to have a more stable access pattern across switches. ASAP uses a combination of offline profiling (identifying frequently accessed "extents" within files) and a lightweight runtime module to maintain a concise list of target pages.
- Anonymous pages: These pages have more dynamic access patterns. ASAP uses a runtime analysis approach, tracking page faults and access logs to dynamically identify pages that are likely to be needed in the next switch. Pages that are frequently accessed are promoted to a "Prepaging Target Table."
- Prepaging Manager: This component orchestrates the prepaging process. It wakes up prepaging threads when an app switch is detected. These threads work in parallel with application threads to fetch pages from the target table. To minimize interference with the main application, anonymous page prepaging threads are given the lowest priority (SCHED_IDLE), while file-backed page prepaging threads are scheduled on high-performance cores with normal priority to ensure timely fetching of critical file data.
ASAP is integrated into the Linux kernel, making it application-agnostic and requiring no modifications to existing applications.
Datasets
The paper does not explicitly mention or create new datasets for training. Instead, it uses a set of eight popular Android applications for evaluation. These applications represent a spectrum of usage patterns, including games, news readers, social media, and productivity apps. The evaluation is performed on Google Pixel 4 (high-end) and Pixel 3a (mid-end) devices.
Key Insights and Ideas
- Invariant vs. Dynamic Footprints: The paper highlights a crucial difference between file-backed pages (largely invariant access patterns) and anonymous pages (dynamic access patterns). This insight is key to designing specialized estimators for each type of page.
- Underutilized Resources: During app switches under memory pressure, CPU and disk bandwidth are significantly underutilized. ASAP aims to leverage these idle resources for proactive page fetching.
- Prepaging as a Solution: The core idea that prepaging can bridge the gap between ideal switch times and real-world switch times under memory pressure is central to the paper.
- Adaptive Prediction is Crucial: Relying solely on static profiling for anonymous pages would be ineffective. The adaptive nature of ASAP's estimator for anonymous pages is essential for capturing their dynamic behavior.
- Careful Thread Scheduling: The paper emphasizes the importance of scheduling prepaging threads appropriately to avoid interfering with the main application's performance. Using low-priority threads for anonymous pages and high-priority threads on performance cores for file-backed pages is a clever approach.
Key Results
- Significant Speedup: ASAP reduces application switch time by an average of 22.2% on Pixel 4 and 28.3% on Pixel 3a. Maximum reductions reached 33.3% (YT) and 35.7% (TW).
- Improved Resource Utilization: ASAP increases CPU utilization by an average of 39.8% and disk bandwidth utilization by 25.2% on Pixel 4 during app switches.
- High Prediction Accuracy: The Switch Footprint Estimator achieves an average prediction accuracy of 79.3% for file-backed pages and 68.4% for anonymous pages.
- File-backed SFE Precision: The estimator for file-backed pages shows higher precision (79.3%) compared to anonymous pages (68.4%), attributed to their more static access patterns.
- Minimal Overhead: The additional memory overhead of ASAP is around 800KB per application, and the impact on switch time due to access bit logging is minimal (up to 14ms).
Limitations and Future Work
- Limited Scope of Evaluation: While the paper evaluates eight popular applications, the authors acknowledge that user behavior and application usage patterns can vary widely.
- Potential for Extension: The authors believe ASAP can be easily extended to reduce application launch times as well.
- Core Scheduling Policies: The paper explores different core scheduling policies for file prepaging threads, suggesting that the optimal policy can be application-dependent. Further research into more dynamic and adaptive core scheduling could be beneficial.
- Energy Consumption: While the paper argues that ASAP's latency reduction offsets its marginal energy overhead, a more detailed energy analysis could be valuable.
The authors have open-sourced the modified Linux kernel for ASAP, available at https://github.com/SNU-ARC/atc21-asap-kernel.
Summary updated