lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <480fd747-d8d7-0830-0b97-bf2069dbef07@redhat.com>
Date:   Wed, 4 Aug 2021 21:08:57 +0200
From:   David Hildenbrand <david@...hat.com>
To:     zhangkui <zhangkui@...o.com>, akpm@...ux-foundation.org,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/madvise: add MADV_WILLNEED to process_madvise()

On 04.08.21 10:20, zhangkui wrote:
> 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.
> 
> Signed-off-by: zhangkui <zhangkui@...o.com>
> ---
>   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;
>          default:
>                  return false;

I guess this should be fine. In contrast to other (e.g., destructive) 
madvise calls, an application could merely notice the difference that 
for example, in the pagemap something is suddenly no longer swapped, 
even thought the page wasn't touched by the process. But that can also 
happen e.g., during swapoff.

So I think this is fine, but let's hear if there are concerns.

-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ