linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nico Pache <npache@redhat.com>
To: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	 linux-mm@kvack.org
Cc: akpm@linux-foundation.org, shuah@kernel.org, donettom@linux.vnet.ibm.com
Subject: Re: [PATCH] selftests: mm: fix map_hugetlb failure on 64K page size systems
Date: Fri, 19 Jan 2024 06:11:53 -0700	[thread overview]
Message-ID: <CAA1CXcD55JLQfpW8OzzfHsyaVX5cJHO-y7v8miRyL1t3fnejqg@mail.gmail.com> (raw)
In-Reply-To: <20240119125753.152354-1-npache@redhat.com>

NACK.

I accidentally sent an older version of this patch. Following up with V2.

On Fri, Jan 19, 2024 at 5:58 AM Nico Pache <npache@redhat.com> wrote:
>
> On systems with 64k page size and 512M huge page sizes, the allocation
> and test succeeds but errors out at the munmap. As the comment states,
> munmap will failure if its not HUGEPAGE aligned. This is due to the
> length of the mapping being 1/2 the size of the hugepage causing the
> munmap to not be hugepage aligned. Fix this by making the mapping length
> the full hugepage if the hugepage is larger than the length of the
> mapping.
>
> Signed-off-by: Nico Pache <npache@redhat.com>
> ---
>  tools/testing/selftests/mm/map_hugetlb.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/map_hugetlb.c b/tools/testing/selftests/mm/map_hugetlb.c
> index 193281560b61..dcb8095fcd45 100644
> --- a/tools/testing/selftests/mm/map_hugetlb.c
> +++ b/tools/testing/selftests/mm/map_hugetlb.c
> @@ -58,10 +58,16 @@ int main(int argc, char **argv)
>  {
>         void *addr;
>         int ret;
> +       size_t maplength;
>         size_t length = LENGTH;
>         int flags = FLAGS;
>         int shift = 0;
>
> +       maplength = default_huge_page_size();
> +       /* mmap with fail if the length is not page */
> +       if (maplength > length)
> +               length = maplength;
> +
>         if (argc > 1)
>                 length = atol(argv[1]) << 20;
>         if (argc > 2) {
> --
> 2.43.0
>



      reply	other threads:[~2024-01-19 13:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 12:57 Nico Pache
2024-01-19 13:11 ` Nico Pache [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=CAA1CXcD55JLQfpW8OzzfHsyaVX5cJHO-y7v8miRyL1t3fnejqg@mail.gmail.com \
    --to=npache@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=donettom@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.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