]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/madvise: add MADV_WILLNEED to process_madvise()
authorzhangkui <zhangkui@oppo.com>
Mon, 23 Aug 2021 23:59:39 +0000 (09:59 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Aug 2021 23:34:21 +0000 (09:34 +1000)
commitc9c3dca84331d7afd1c4522e22b3d8ed17071b80
tree8524a7cc98b8f206cb14d601bd4d0e325f10ee87
parent15fd61a615d038c1546f5b590fbdd49a9812b5c9
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: Stephen Rothwell <sfr@canb.auug.org.au>
mm/madvise.c