[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e9207c67-40d9-23c9-3c90-677e0a605566@redhat.com>
Date: Mon, 17 Jul 2023 19:22:12 +0200
From: David Hildenbrand <david@...hat.com>
To: Ryan Roberts <ryan.roberts@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Shuah Khan <shuah@...nel.org>,
Jérôme Glisse <jglisse@...hat.com>,
Mark Brown <broonie@...nel.org>,
John Hubbard <jhubbard@...dia.com>,
Florent Revest <revest@...omium.org>,
Peter Xu <peterx@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v2 4/8] selftests/mm: Fix thuge-gen test bugs
On 17.07.23 12:31, Ryan Roberts wrote:
> thuge-gen was previously only munmapping part of the mmapped buffer,
> which caused us to run out of 1G huge pages for a later part of the
> test. Fix this by munmapping the whole buffer. Based on the code, it
> looks like a typo rather than an intention to keep some of the buffer
> mapped.
>
> thuge-gen was also calling mmap with SHM_HUGETLB flag (bit 11 set),
> which is actually MAP_DENYWRITE in mmap context. The man page says this
> flag is ignored in modern kernels. I'm pretty sure from the context that
> the author intended to pass the MAP_HUGETLB flag so I've fixed that up
> too.
Makes sense to me.
>
> Signed-off-by: Ryan Roberts <ryan.roberts@....com>
> ---
> tools/testing/selftests/mm/thuge-gen.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/thuge-gen.c b/tools/testing/selftests/mm/thuge-gen.c
> index 380ab5f0a534..16ed4dfa7359 100644
> --- a/tools/testing/selftests/mm/thuge-gen.c
> +++ b/tools/testing/selftests/mm/thuge-gen.c
> @@ -139,7 +139,7 @@ void test_mmap(unsigned long size, unsigned flags)
> before, after, before - after, size);
> assert(size == getpagesize() || (before - after) == NUM_PAGES);
> show(size);
> - err = munmap(map, size);
> + err = munmap(map, size * NUM_PAGES);
> assert(!err);
> }
>
> @@ -222,7 +222,7 @@ int main(void)
> test_mmap(ps, MAP_HUGETLB | arg);
> }
> printf("Testing default huge mmap\n");
> - test_mmap(default_hps, SHM_HUGETLB);
> + test_mmap(default_hps, MAP_HUGETLB);
>
> puts("Testing non-huge shmget");
> test_shmget(getpagesize(), 0);
Reviewed-by: David Hildenbrand <david@...hat.com>
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists