archive mirror
 help / color / mirror / Atom feed
From: zhangkui <>
Cc: zhangkui <>
Subject: [PATCH] mm/madvise: add MADV_WILLNEED to process_madvise()
Date: Wed,  4 Aug 2021 16:20:10 +0800	[thread overview]
Message-ID: <> (raw)

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
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.

Signed-off-by: zhangkui <>
 mm/madvise.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/madvise.c b/mm/madvise.c
index 6d3d348b17f4..b9681fb3fbb5 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -1046,6 +1046,7 @@ process_madvise_behavior_valid(int behavior)
        switch (behavior) {
        case MADV_COLD:
        case MADV_PAGEOUT:
+       case MADV_WILLNEED:
                return true;
                return false;



This e-mail and its attachments contain confidential information from OPPO, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

             reply	other threads:[~2021-08-04  8:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04  8:20 zhangkui [this message]
2021-08-04 19:08 ` David Hildenbrand
2021-08-05  2:00 ` Andrew Morton
2021-08-05  2:58   ` 张魁(Kyler)
2021-08-05  2:04 ` Andrew Morton
2021-08-05  4:50   ` 张魁(Kyler)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \
    --subject='Re: [PATCH] mm/madvise: add MADV_WILLNEED to process_madvise()' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox