Skip to content

Commit d5fffc5

Browse files
zhangkuitorvalds
authored andcommitted
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, System Management Software 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://lkml.kernel.org/r/[email protected] Signed-off-by: zhangkui <[email protected]> Cc: David Hildenbrand <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 33090af commit d5fffc5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

mm/madvise.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,7 @@ process_madvise_behavior_valid(int behavior)
10481048
switch (behavior) {
10491049
case MADV_COLD:
10501050
case MADV_PAGEOUT:
1051+
case MADV_WILLNEED:
10511052
return true;
10521053
default:
10531054
return false;

0 commit comments

Comments
 (0)