安卓裝置上應用層級差異化之交換管理策略
Hybrid Swap with App-Level Differentiation for Android Mobile Devices
摘要
As mobile apps run simultaneously, they become high memory demand. The system must
utilize multiple swap for a good user experience. However, we found that the kernel swap
allocation in Android devices under multiple swap suffers from slow swap-in speeds, which
increases app-switching latency—one of the most noticeable delays for users. Specifically, the
kernel allocates swap slots to pages only based on the order of their arrival, without considering
whether they would likely be used or not. This results in slower swap-in speeds, thereby caus-
ing a negative impact on user experience. This paper presents the App-Aware Hybrid Swap,
allocating swap slots based on app-specific behavior to optimize app-switching. Our approach
consists of three main components. Firstly, we prevent the cold app pages from occupying
zRAM by directly allocating them to flash swap. Secondly, we reclaim dormant pages from
zRAM and prioritize them to flash swap. Finally, we cluster swap pages from the same process
into contiguous flash swap slots and prefetch nearby pages from flash swap based on a window
size that considers app behavior for improving flash I/O efficiency. We evaluate our App-Aware
Hybrid Swap on the Google Pixel 7. Our results show that our approach achieves up to 49%
improvement in app-switching latency.
utilize multiple swap for a good user experience. However, we found that the kernel swap
allocation in Android devices under multiple swap suffers from slow swap-in speeds, which
increases app-switching latency—one of the most noticeable delays for users. Specifically, the
kernel allocates swap slots to pages only based on the order of their arrival, without considering
whether they would likely be used or not. This results in slower swap-in speeds, thereby caus-
ing a negative impact on user experience. This paper presents the App-Aware Hybrid Swap,
allocating swap slots based on app-specific behavior to optimize app-switching. Our approach
consists of three main components. Firstly, we prevent the cold app pages from occupying
zRAM by directly allocating them to flash swap. Secondly, we reclaim dormant pages from
zRAM and prioritize them to flash swap. Finally, we cluster swap pages from the same process
into contiguous flash swap slots and prefetch nearby pages from flash swap based on a window
size that considers app behavior for improving flash I/O efficiency. We evaluate our App-Aware
Hybrid Swap on the Google Pixel 7. Our results show that our approach achieves up to 49%
improvement in app-switching latency.
當手機應用程式同時運行時,它們的內存需求會變得很高。為了提供良好的用戶體
驗,系統必須利用多重交換。然而,我們發現,在多重交換下,安卓設備的內核交換
分配會遭遇到交換速度慢的問題,這增加了應用切換延遲——這是用戶最明顯的延遲
之一。具體來說,內核僅根據頁面到達的順序來分配交換槽,而不考慮它們是否可能
會被使用。這導致交換速度變慢,從而對用戶體驗產生負面影響。本文提出了應用感
知混合交換,根據應用特定行為來分配交換槽,以優化應用切換。我們的方法包括三
個主要部分。首先,我們通過直接將不常用的應用程式頁面分配到快閃交換來防止它
們佔用zRAM。其次,我們從zRAM中回收休眠頁面,並優先將它們分配到快閃交換。
最後,我們將來自同一進程的交換頁面聚集到連續的快閃交換槽中,並根據考慮應用
行為的窗口大小預取來自快閃交換的附近頁面,以提高快閃I/O效率。我們在Google
Pixel 7上評估了我們的應用感知混合交換。我們的結果表明,我們的方法在應用切換延
遲方面達到了高達49%的改善。
驗,系統必須利用多重交換。然而,我們發現,在多重交換下,安卓設備的內核交換
分配會遭遇到交換速度慢的問題,這增加了應用切換延遲——這是用戶最明顯的延遲
之一。具體來說,內核僅根據頁面到達的順序來分配交換槽,而不考慮它們是否可能
會被使用。這導致交換速度變慢,從而對用戶體驗產生負面影響。本文提出了應用感
知混合交換,根據應用特定行為來分配交換槽,以優化應用切換。我們的方法包括三
個主要部分。首先,我們通過直接將不常用的應用程式頁面分配到快閃交換來防止它
們佔用zRAM。其次,我們從zRAM中回收休眠頁面,並優先將它們分配到快閃交換。
最後,我們將來自同一進程的交換頁面聚集到連續的快閃交換槽中,並根據考慮應用
行為的窗口大小預取來自快閃交換的附近頁面,以提高快閃I/O效率。我們在Google
Pixel 7上評估了我們的應用感知混合交換。我們的結果表明,我們的方法在應用切換延
遲方面達到了高達49%的改善。