Linux-man Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] madvise.2: MADV_WIPEONFORK affects semantics
@ 2020-04-28 17:40 agl
  2020-04-28 18:09 ` Jakub Wilk
  0 siblings, 1 reply; 4+ messages in thread
From: agl @ 2020-04-28 17:40 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man, alangley

Include MADV_WIPEONFORK in the list of advice values that have a
semantic impact on the calling process.
---
  man2/madvise.2 | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/man2/madvise.2 b/man2/madvise.2
index a0f3a477a..6c25f697a 100644
--- a/man2/madvise.2
+++ b/man2/madvise.2
@@ -84,21 +84,23 @@ values have been added.
  The
  .I advice
  values listed below
  allow an application to tell the kernel how it expects to use
  some mapped or shared memory areas, so that the kernel can choose
  appropriate read-ahead and caching techniques.
  These
  .I advice
  values do not influence the semantics of the application
  (except in the case of
-.BR MADV_DONTNEED ),
+.BR MADV_DONTNEED
+and
+.BR MADV_WIPEONFORK ),
  but may influence its performance.
  All of the
  .I advice
  values listed here have analogs in the POSIX-specified
  .BR posix_madvise (3)
  function, and the values have the same meanings, with the exception of
  .BR MADV_DONTNEED .
  .PP
  The advice is indicated in the
  .I advice
-- 
2.26.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] madvise.2: MADV_WIPEONFORK affects semantics
  2020-04-28 17:40 [PATCH] madvise.2: MADV_WIPEONFORK affects semantics agl
@ 2020-04-28 18:09 ` Jakub Wilk
  2020-04-29  6:09   ` Michael Kerrisk (man-pages)
  2020-04-29 13:47   ` Adam Langley
  0 siblings, 2 replies; 4+ messages in thread
From: Jakub Wilk @ 2020-04-28 18:09 UTC (permalink / raw)
  To: Adam Langley; +Cc: Michael Kerrisk, linux-man, alangley

Hi Adam!

* Adam Langley <agl@google.com>, 2020-04-28, 17:40:
> These
> .I advice
> values do not influence the semantics of the application
> (except in the case of
>-.BR MADV_DONTNEED ),
>+.BR MADV_DONTNEED
>+and
>+.BR MADV_WIPEONFORK ),
> but may influence its performance.

This sentence is in the "Conventional advice value" subsection, which 
defines only MADV_NORMAL, MADV_RANDOM, MADV_SEQUENTIAL, MADV_WILLNEED, 
and MADV_DONTNEED.

MADV_WIPEONFORK is defined in the "Linux-specific advice values" 
subsection, which already notes that "some of these operations change 
the semantics of memory accesses". (Perhaps s/some/most/ would be better 
wording.)

-- 
Jakub Wilk

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] madvise.2: MADV_WIPEONFORK affects semantics
  2020-04-28 18:09 ` Jakub Wilk
@ 2020-04-29  6:09   ` Michael Kerrisk (man-pages)
  2020-04-29 13:47   ` Adam Langley
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-04-29  6:09 UTC (permalink / raw)
  To: Jakub Wilk; +Cc: Adam Langley, linux-man, alangley

Hello Jakub (and Adam),

On Tue, 28 Apr 2020 at 20:09, Jakub Wilk <jwilk@jwilk.net> wrote:
>
> Hi Adam!
>
> * Adam Langley <agl@google.com>, 2020-04-28, 17:40:
> > These
> > .I advice
> > values do not influence the semantics of the application
> > (except in the case of
> >-.BR MADV_DONTNEED ),
> >+.BR MADV_DONTNEED
> >+and
> >+.BR MADV_WIPEONFORK ),
> > but may influence its performance.
>
> This sentence is in the "Conventional advice value" subsection, which
> defines only MADV_NORMAL, MADV_RANDOM, MADV_SEQUENTIAL, MADV_WILLNEED,
> and MADV_DONTNEED.

(Good catch.)

> MADV_WIPEONFORK is defined in the "Linux-specific advice values"
> subsection, which already notes that "some of these operations change
> the semantics of memory accesses".

<nod>

> (Perhaps s/some/most/ would be better
> wording.)

Perhaps you are right. Here's my take:

Do change memory semantics:
MADV_REMOVE
MADV_DONTFORK / MADV_DOFORK
MADV_HWPOISON
MADV_FREE
MADV_WIPEONFORK

Don't change memory semantics:
MADV_MERGEABLE / MADV_UNMERGEABLE
MADV_SOFT_OFFLINE
MADV_HUGEPAGE / MADV_NOHUGEPAGE
MADV_DONTDUMP / MADV_DODUMP

Do you agree?

"Some" is perhaps a little loose, but perhaps "most" is overstating
it, so I'm not quite sure what to do here. Perhaps ad a line to each
of the operations in the first category noting that the operations
change memory semantics. THoughts?

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] madvise.2: MADV_WIPEONFORK affects semantics
  2020-04-28 18:09 ` Jakub Wilk
  2020-04-29  6:09   ` Michael Kerrisk (man-pages)
@ 2020-04-29 13:47   ` Adam Langley
  1 sibling, 0 replies; 4+ messages in thread
From: Adam Langley @ 2020-04-29 13:47 UTC (permalink / raw)
  To: Jakub Wilk; +Cc: Michael Kerrisk, linux-man, Adam Langley

On Tue, Apr 28, 2020 at 11:09 AM Jakub Wilk <jwilk@jwilk.net> wrote:
> This sentence is in the "Conventional advice value" subsection, which
> defines only MADV_NORMAL, MADV_RANDOM, MADV_SEQUENTIAL, MADV_WILLNEED,
> and MADV_DONTNEED.
>
> MADV_WIPEONFORK is defined in the "Linux-specific advice values"
> subsection, which already notes that "some of these operations change
> the semantics of memory accesses". (Perhaps s/some/most/ would be better
> wording.)

Ah, thank you! Now that I look with that in mind, it makes sense.


AGL

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 17:40 [PATCH] madvise.2: MADV_WIPEONFORK affects semantics agl
2020-04-28 18:09 ` Jakub Wilk
2020-04-29  6:09   ` Michael Kerrisk (man-pages)
2020-04-29 13:47   ` Adam Langley

Linux-man Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-man/0 linux-man/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-man linux-man/ https://lore.kernel.org/linux-man \
		linux-man@vger.kernel.org
	public-inbox-index linux-man

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-man


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git