linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Peter Xu <peterx@redhat.com>
Cc: linux-man@vger.kernel.org, linux-mm@kvack.org,
	Alejandro Colomar <alx.manpages@gmail.com>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	David Hildenbrand <david@redhat.com>,
	Axel Rasmussen <axelrasmussen@google.com>
Subject: Re: [PATCH] madvise.2: Clarify addr/length and update hugetlb support
Date: Wed, 25 May 2022 13:50:19 -0700	[thread overview]
Message-ID: <f8a5053c-f7e6-e64d-cc26-eb641dfd9215@oracle.com> (raw)
In-Reply-To: <Yo53tu0CZV5izp1U@xz-m1.local>

On 5/25/22 11:38, Peter Xu wrote:
> Hi, Mike,
> 
> Some minor nitpicks below.
> 
> On Tue, May 24, 2022 at 04:28:44PM -0700, Mike Kravetz wrote:
>>  .B MADV_DONTNEED
>> -cannot be applied to locked pages, Huge TLB pages, or
>> +cannot be applied to locked pages, or
>>  .BR VM_PFNMAP
>>  pages.
> 
> This looks good, but since this will be a behavior change and we won't be
> able to change the old kernels, I saw the man page normally does this with
> things like:
> 
>   Since Linux 5.18, this madvise supports hugetlbfs page> 
> Majorly it states starting from which version it'll work, and when it'll
> not.

You are right.  I will add this.
> 
>>  (Pages marked with the kernel-internal
>> @@ -170,24 +174,24 @@ Note that some of these operations change the semantics of memory accesses.
>>  .\" commit f6b3ec238d12c8cc6cc71490c6e3127988460349
>>  Free up a given range of pages
>>  and its associated backing store.
>> -This is equivalent to punching a hole in the corresponding byte
>> +This is equivalent to punching a hole in the corresponding
>>  range of the backing store (see
>>  .BR fallocate (2)).
>>  Subsequent accesses in the specified address range will see
>> -bytes containing zero.
>> +pages containing zero.
>>  .\" Databases want to use this feature to drop a section of their
>>  .\" bufferpool (shared memory segments) - without writing back to
>>  .\" disk/swap space.  This feature is also useful for supporting
>>  .\" hot-plug memory on UML.
>>  .IP
>>  The specified address range must be mapped shared and writable.
>> -This flag cannot be applied to locked pages, Huge TLB pages, or
>> +This flag cannot be applied to locked pages, or
>>  .BR VM_PFNMAP
>>  pages.
>>  .IP
>>  In the initial implementation, only
>>  .BR tmpfs (5)
>> -was supported
>> +supported
>>  .BR MADV_REMOVE ;
>>  but since Linux 3.5,
>>  .\" commit 3f31d07571eeea18a7d34db9af21d2285b807a17
>> @@ -196,9 +200,9 @@ any filesystem which supports the
>>  .BR FALLOC_FL_PUNCH_HOLE
>>  mode also supports
>>  .BR MADV_REMOVE .
>> -Hugetlbfs fails with the error
>> -.BR EINVAL
>> -and other filesystems fail with the error
>> +Filesystems which do not support
>> +.BR MADV_REMOVE
>> +fail with the error
>>  .BR EOPNOTSUPP .
>>  .TP
>>  .BR MADV_DONTFORK " (since Linux 2.6.16)"
>> @@ -596,6 +600,18 @@ that are not mapped, the Linux version of
>>  ignores them and applies the call to the rest (but returns
>>  .B ENOMEM
>>  from the system call, as it should).
>> +.PP
>> +If the specified address
>> +.I addr
>> +is within a mapping backed by Huge TLB pages, then
>> +.I addr
>> +must be aligned to the underlying Huge TLB page size.  If the range
>> +specified by
>> +.I addr
>> +and
>> +.I length
>> +ends in a mapping backed by Huge TLB pages, then the end of the range
>> +will be rounded up to a multiple of the underlying Huge TLB page size.
> 
> I'm slightly worried this could be hidden too deep, meanwhile it duplicates
> part of the sentence of how start/end will be treated.

Yes, I just dumped more stuff into the NOTES section.  Will rearrange as
you suggested.

> 
> How about adding a short paragraph into each of MADV_DONTNEED and
> MADV_REMOVE section (right after the new sentences upon hugetlbfs), with:
> 
>   For hugetlbfs, the start/end alignments on page sizes will be based on
>   huge page size.
> 
> No strong opinions on any of these.  Anyway:
> 
> Acked-by: Peter Xu <peterx@redhat.com>

Thanks Peter
-- 
Mike Kravetz


      reply	other threads:[~2022-05-25 20:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24 23:28 [PATCH] madvise.2: Clarify addr/length and update hugetlb support Mike Kravetz
2022-05-25 18:38 ` Peter Xu
2022-05-25 20:50   ` Mike Kravetz [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=f8a5053c-f7e6-e64d-cc26-eb641dfd9215@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=alx.manpages@gmail.com \
    --cc=axelrasmussen@google.com \
    --cc=david@redhat.com \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mtk.manpages@gmail.com \
    --cc=peterx@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).