From 2e06e5e6f89e21bcbcdbc5595d6f95946a2519b1 Mon Sep 17 00:00:00 2001 From: Liujie Xie Date: Sat, 14 Aug 2021 14:46:42 +0800 Subject: [PATCH] FROMLIST: mm/madvise: add MADV_WILLNEED to process_madvise() There is a usecase in Android that an app process's memory is swapped out by process_madvise() with MADV_PAGEOUT, such as the memory is swapped to zram or a backing device. When the process is scheduled to running, like switch to foreground, multiple page faults may cause the app dropped frames. To reduce the problem, SMS can read-ahead memory of the process immediately when the app switches to forground. Calling process_madvise() with MADV_WILLNEED can meet this need. Link: https://lore.kernel.org/patchwork/patch/1472006/ Bug: 194967441 Signed-off-by: Kui Zhang Signed-off-by: Liujie Xie Change-Id: Ie4203ff76da74cf34498cfee6569a6c7fc624bb2 --- mm/madvise.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/madvise.c b/mm/madvise.c index 9ec5037bf297..e865ae74a5bf 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -996,6 +996,7 @@ process_madvise_behavior_valid(int behavior) switch (behavior) { case MADV_COLD: case MADV_PAGEOUT: + case MADV_WILLNEED: return true; default: return false;