]> git.baikalelectronics.ru Git - kernel.git/commit
mm/madvise: add MADV_WILLNEED to process_madvise()
authorzhangkui <zhangkui@oppo.com>
Thu, 2 Sep 2021 22:01:11 +0000 (15:01 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 3 Sep 2021 16:58:18 +0000 (09:58 -0700)
commit8dfeb95fbfa562af90968e832f7557d3f4c0fc4b
treeb81923d12a8e57ef14e32cccae59d0c5f20c18fb
parenta7d5027963e13dce2854f5538b39c452d0be4a7a
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/20210804082010.12482-1-zhangkui@oppo.com
Signed-off-by: zhangkui <zhangkui@oppo.com>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/madvise.c