From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Alejandro Colomar <alx@kernel.org>,
linux-man@vger.kernel.org, Suren Baghdasaryan <surenb@google.com>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Matthew Wilcox <willy@infradead.org>,
Jann Horn <jannh@google.com>,
linux-mm@kvack.org
Subject: Re: [PATCH man-pages v4] madvise.2: add MADV_GUARD_INSTALL, MADV_GUARD_REMOVE description
Date: Fri, 6 Dec 2024 11:22:25 +0000 [thread overview]
Message-ID: <5d1fc62c-bc85-438e-8231-4ed41727dc53@lucifer.local> (raw)
In-Reply-To: <4146fb6a-9866-4884-9d8e-da8c7c61256d@lucifer.local>
On Fri, Dec 06, 2024 at 11:03:56AM +0000, Lorenzo Stoakes wrote:
> On Thu, Dec 05, 2024 at 09:43:09PM +0100, Vlastimil Babka wrote:
> > On 12/5/24 19:09, Lorenzo Stoakes wrote:
> > > On Thu, Dec 05, 2024 at 06:50:09PM +0100, Vlastimil Babka wrote:
> > >> On 12/5/24 11:41, Lorenzo Stoakes wrote:
> > >> > Lightweight guard region support has been added to Linux 6.13, which adds
> > >> > MADV_GUARD_INSTALL and MADV_GUARD_REMOVE flags to the madvise() system
> > >> > call. Therefore, update the manpage for madvise() and describe these
> > >> > operations.
> > >> >
> > >> > Reviewed-by: Jann Horn <jannh@google.com>
> > >> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> > >> > ---
> > >> > v4:
> > >> > * Reference function chapters as per Alejandro.
> > >> > * Minor rewording as per Alejandro.
> > >> >
> > >> > v3:
> > >> > * Don't describe SIGSEGV as a fatal signal as per Jann.
> > >> > https://lore.kernel.org/all/20241202165829.72121-1-lorenzo.stoakes@oracle.com
> > >> >
> > >> > v2:
> > >> > * Updated to use semantic newlines as suggested by Alejandro.
> > >> > * Avoided emboldening parens as suggested by Alejandro.
> > >> > * One very minor grammatical fix.
> > >> > https://lore.kernel.org/all/20241129155943.85215-1-lorenzo.stoakes@oracle.com
> > >> >
> > >> > v1:
> > >> > https://lore.kernel.org/all/20241129093205.8664-1-lorenzo.stoakes@oracle.com
> > >> >
> > >> > man/man2/madvise.2 | 93 ++++++++++++++++++++++++++++++++++++++++++++++
> > >> > 1 file changed, 93 insertions(+)
> > >> >
> > >> > diff --git a/man/man2/madvise.2 b/man/man2/madvise.2
> > >> > index 4f2210ee2..7d682fa40 100644
> > >> > --- a/man/man2/madvise.2
> > >> > +++ b/man/man2/madvise.2
> > >> > @@ -676,6 +676,91 @@ or secret memory regions created using
> > >> > Note that with
> > >> > .BR MADV_POPULATE_WRITE ,
> > >> > the process can be killed at any moment when the system runs out of memory.
> > >> > +.TP
> > >> > +.BR MADV_GUARD_INSTALL " (since Linux 6.13)"
> > >> > +Install a lightweight guard region into the range specified by
> > >> > +.I addr
> > >> > +and
> > >> > +.IR size ,
> > >> > +causing any read or write in the range to result in a
> > >> > +.B SIGSEGV
> > >> > +signal being raised.
> > >> > +.IP
> > >> > +If the region maps memory pages they will be cleared as part of the operation,
> > >> > +though if
> > >>
> > >> Hm this reads a bit ambiguous. One could read it as the memory pages are
> > >> being cleared, but it's the page tables.
> > >
> > > This was really hard to word, because you don't want to say unmapped, and saying
> > > 'clearing page tables' or 'zapping' is clear to us but not necessarily to a
> > > reader. 'Clearing mapping' makes it ambiguous vs. munmap(), etc. etc.
> >
> > Maybe saying "removed" instead of "cleared" would be better?
>
> I was about to put more philosophical points here then realised we already have
> a better solution... we can say 'the regions will become zero-fill-on-demand'.
>
> Let me respin a v5 with this corrected. We will need to revisit once we
> support file-backed pages.
Actually, as discussed on IRC, I think your suggested 'replaced' is better, so:
"If the region maps memory pages, those mappings will be replaced".
Will address in v5.
>
> >
> > Anyway, I don't want to cause bikeshedding, so in any case:
>
> No it's appreciated! Review should be critical so we can make this as good
> as we can make it.
>
> >
> > Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
>
> Thanks!
>
> >
> > > But you want to make it clear (no pun intended) that anon pages, if there's any
> > > data, it's probably lost. So I think this is a distinction that doesn't matter.
> > >
> > > Will revisit once we support file-backed mappings.
> > >
prev parent reply other threads:[~2024-12-06 11:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 10:41 Lorenzo Stoakes
2024-12-05 12:20 ` Alejandro Colomar
2024-12-05 12:26 ` Lorenzo Stoakes
2024-12-05 12:43 ` git repositories and branches (was: [PATCH man-pages v4] madvise.2: ...) Alejandro Colomar
2024-12-05 13:06 ` Lorenzo Stoakes
2024-12-05 17:50 ` [PATCH man-pages v4] madvise.2: add MADV_GUARD_INSTALL, MADV_GUARD_REMOVE description Vlastimil Babka
2024-12-05 18:09 ` Lorenzo Stoakes
2024-12-05 20:43 ` Vlastimil Babka
2024-12-05 22:53 ` Alejandro Colomar
2024-12-06 11:03 ` Lorenzo Stoakes
2024-12-06 11:22 ` Lorenzo Stoakes [this message]
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=5d1fc62c-bc85-438e-8231-4ed41727dc53@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