# Re: \[PATCH v1\] madvise.2: Document MADV\_POPULATE\_READ and MADV\_POPULATE\_WRITE

- From: David Hildenbrand \<hidden\>
- Date: 2021-07-26 07:11:46 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2021/07/6510076
- Thread: https://ratatoskr.run/linux-man/2021/07/6509755/t.md

```text
Hi Alex,

>>> ---
>>>    man2/madvise.2 | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>>    1 file changed, 80 insertions(+)
>>>
>>> diff --git a/man2/madvise.2 b/man2/madvise.2
>>> index f1f384c0c..3ec8c53a7 100644
>>> --- a/man2/madvise.2
>>> +++ b/man2/madvise.2
>>> @@ -469,6 +469,59 @@ If a page is file-backed and dirty, it will be written back to the backing
>>>    storage.
>>>    The advice might be ignored for some pages in the range when it is not
>>>    applicable.
>>> +.TP
>>> +.BR MADV_POPULATE_READ " (since Linux 5.14)
>
> s/$/"/


Thanks!


>
>>> +Populate (prefault) page tables readable for the whole range without actually
>
> See the following extract from man-pages(7):
>
> $ man 7 man-pages | sed -n '/Use semantic newlines/,/^$/p';
>      Use semantic newlines
>          In the source of a manual page,  new  sentences  should  be
>          started  on new lines, and long sentences should split into
>          lines at clause breaks (commas, semicolons, colons, and  so
>          on).   This  convention,  sometimes known as "semantic new‐
>          lines", makes it easier to see the effect of patches, which
>          often  operate at the level of individual sentences or sen‐
>          tence clauses.

Thanks, something like the following (also limiting to 80 characters
per page) work?

"
Populate (prefault) page tables readable for the whole range without actually
reading.
Depending on the underlying mapping,
map the shared zeropage,
preallocate memory or read the underlying file;
files with holes might or might not preallocate blocks.
"

>
>>> +reading. Depending on the underlying mapping, map the shared zeropage,
>>> +preallocate memory or read the underlying file; files with holes might or
>>> +might not preallocate blocks.
>>> +Do not generate
>>> +.B SIGBUS
>>> +when populating fails, return an error instead.
>>> +.IP
>>> +If
>>> +.B MADV_POPULATE_READ
>>> +succeeds, all page tables have been populated (prefaulted) readable once.
>>> +If
>>> +.B MADV_POPULATE_READ
>>> +fails, some page tables might have been populated.
>>> +.IP
>>> +.B MADV_POPULATE_READ
>>> +cannot be applied to mappings without read permissions
>>> +and special mappings marked with the kernel-internal
>>> +.B VM_PFNMAP
>>> +and
>>> +.BR VM_IO .
>>> +.IP
>>> +Note that with
>>> +.BR MADV_POPULATE_READ ,
>>> +the process can be killed at any moment when the system runs out of memory.
>>> +.TP
>>> +.BR MADV_POPULATE_WRITE " (since Linux 5.14)
>
> s/$/"/

Thanks!

-- 
Thanks,

David / dhildenb

```
