linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Alejandro Colomar <alx@kernel.org>
Cc: linux-man@vger.kernel.org, Suren Baghdasaryan <surenb@google.com>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Matthew Wilcox <willy@infradead.org>,
	Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH v2] madvise.2: update MADV_GUARD_INSTALL, MADV_GUARD_REMOVE description
Date: Thu, 1 May 2025 10:53:51 +0100	[thread overview]
Message-ID: <3472d46d-3a93-4de3-8ec4-14f972d06da3@lucifer.local> (raw)
In-Reply-To: <20250423183105.116978-1-lorenzo.stoakes@oracle.com>

Hey Alejandro,

Just a gentle ping on this :) Let me know if you need me to do anything
else on this!

Cheers, Lorenzo

On Wed, Apr 23, 2025 at 07:31:05PM +0100, Lorenzo Stoakes wrote:
> Lightweight guard region support has been extended in Linux 6.15,
> permitting the use of these features for file-backed and read-only
> mappings.
>
> Update the description for these operations in the madvise manpage to
> describe the changed behaviour.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> v2:
> (all as per Alejandro :)
> * Removed v prefixes on linux version numbers.
> * Removed invalid blank line.
> * Various style and layout fixups.
>
> v1:
> https://lore.kernel.org/all/20250317210653.273728-1-lorenzo.stoakes@oracle.com/
>
>  man/man2/madvise.2 | 39 +++++++++++++++++++++++++++++----------
>  1 file changed, 29 insertions(+), 10 deletions(-)
>
> diff --git a/man/man2/madvise.2 b/man/man2/madvise.2
> index bd2b90b7a..be1ba17ae 100644
> --- a/man/man2/madvise.2
> +++ b/man/man2/madvise.2
> @@ -697,9 +697,24 @@ is applied to regions
>  containing pre-existing lightweight guard regions,
>  they are left in place.
>  .IP
> -This operation is supported
> -only for writable anonymous private mappings
> -which have not been mlock'd.
> +Prior to Linux 6.15,
> +this operation was supported
> +only for writable anonymous private mappings.
> +Since Linux 6.15,
> +both anonymous and file-backed mappings are supported,
> +including read-only mappings.
> +.IP
> +The mapping must not be mlock'd,
> +map hugetlb ranges,
> +nor contain special mappings.
> +For example,
> +mappings marked with kernel-internal flags such as
> +.B VM_PFNMAP
> +or
> +.BR VM_IO ,
> +or secret memory regions created using
> +.BR memfd_secret (2).
> +.IP
>  An
>  .B EINVAL
>  error is returned if it is attempted on any other kind of mapping.
> @@ -756,19 +771,23 @@ and
>  .IP
>  All mappings in the range
>  other than lightweight guard regions
> -are left in place
> -(including mlock'd mappings).
> -The operation is,
> -however,
> -valid only for writable anonymous private mappings,
> +are left in place.
> +The operation is supported on those mappings
> +permitted by
> +.B MADV_GUARD_INSTALL
> +in addition to mlock()'d mappings,
>  returning an
>  .B EINVAL
>  error otherwise.
>  .IP
>  When lightweight guard regions are removed,
>  they act as empty regions of the containing mapping.
> -Since only writable anonymous private mappings are supported,
> -they therefore become zero-fill-on-demand pages.
> +Therefore,
> +anonymous private mappings become
> +zero-fill-on-demand pages,
> +and file-backed mappings are repopulated with the
> +memory contents from the up-to-date contents of the
> +underlying mapped file.
>  .IP
>  If any transparent huge pages are encountered in the operation,
>  they are left in place.
> --
> 2.49.0


  reply	other threads:[~2025-05-01  9:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 18:31 Lorenzo Stoakes
2025-05-01  9:53 ` Lorenzo Stoakes [this message]
2025-05-01 11:14   ` Alejandro Colomar
2025-05-01 12:45     ` Lorenzo Stoakes

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=3472d46d-3a93-4de3-8ec4-14f972d06da3@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=alx@kernel.org \
    --cc=jannh@google.com \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox