linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Davide Libenzi <davidel@xmailserver.org>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	Shuah Khan <shuahkh@osg.samsung.com>,
	Hugh Dickins <hughd@google.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Joern Engel <joern@logfs.org>, Jianguo Wu <wujianguo@huawei.com>,
	Eric B Munson <emunson@akamai.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-api@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [patch 2/2] mm, selftests: test return value of munmap for MAP_HUGETLB memory
Date: Fri, 27 Mar 2015 10:52:16 +1100	[thread overview]
Message-ID: <1427413936.23142.4.camel@ellerman.id.au> (raw)
In-Reply-To: <alpine.DEB.2.10.1503261623280.20009@chino.kir.corp.google.com>

On Thu, 2015-03-26 at 16:23 -0700, David Rientjes wrote:
> When MAP_HUGETLB memory is unmapped, the length must be hugepage aligned,
> otherwise it fails with -EINVAL.
> 
> All tests currently behave correctly, but it's better to explcitly test
> the return value for completeness and document the requirement,
> especially if users copy map_hugetlb.c as a sample implementation.
> 
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
>  tools/testing/selftests/powerpc/mm/hugetlb_vs_thp_test.c | 8 ++++++--
> 
> diff --git a/tools/testing/selftests/powerpc/mm/hugetlb_vs_thp_test.c b/tools/testing/selftests/powerpc/mm/hugetlb_vs_thp_test.c
> --- a/tools/testing/selftests/powerpc/mm/hugetlb_vs_thp_test.c
> +++ b/tools/testing/selftests/powerpc/mm/hugetlb_vs_thp_test.c
> @@ -21,9 +21,13 @@ static int test_body(void)
>  		 * Typically the mmap will fail because no huge pages are
>  		 * allocated on the system. But if there are huge pages
>  		 * allocated the mmap will succeed. That's fine too, we just
> -		 * munmap here before continuing.
> +		 * munmap here before continuing.  munmap() length of
> +		 * MAP_HUGETLB memory must be hugepage aligned.
>  		 */
> -		munmap(addr, SIZE);
> +		if (munmap(addr, SIZE)) {
> +			perror("munmap");
> +			return 1;
> +		}
>  	}
>  
>  	p = mmap(addr, SIZE, PROT_READ | PROT_WRITE,

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-03-26 23:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26 23:23 [patch 1/2] mm, doc: cleanup and clarify munmap behavior for hugetlb memory David Rientjes
2015-03-26 23:23 ` [patch 2/2] mm, selftests: test return value of munmap for MAP_HUGETLB memory David Rientjes
2015-03-26 23:52   ` Michael Ellerman [this message]
2015-03-27 13:58 ` [patch 1/2] mm, doc: cleanup and clarify munmap behavior for hugetlb memory Eric B Munson
2015-03-28  1:37   ` David Rientjes
2015-03-30  1:35 ` Hugh Dickins
2015-03-30 14:23   ` Eric B Munson
2015-03-30 20:23     ` Hugh Dickins
2015-04-02 22:40   ` David Rientjes
2015-04-02 22:50     ` [patch -mm] mm, doc: cleanup and clarify munmap behavior for hugetlb memory fix David Rientjes
2015-04-03  1:05       ` Hugh Dickins
2015-04-04  9:34       ` Jonathan Corbet
2015-04-09 19:46         ` David Rientjes
2015-04-11 13:26           ` Jonathan Corbet

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=1427413936.23142.4.camel@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=davidel@xmailserver.org \
    --cc=emunson@akamai.com \
    --cc=hughd@google.com \
    --cc=joern@logfs.org \
    --cc=lcapitulino@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=shuahkh@osg.samsung.com \
    --cc=wujianguo@huawei.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