From: Rafael Aquini <raquini@redhat.com>
To: Ryan Roberts <ryan.roberts@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>, Peter Xu <peterx@redhat.com>,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v1 1/3] selftests/mm: Fix half_ufd_size_MB calculation
Date: Tue, 18 Mar 2025 17:49:16 -0400 [thread overview]
Message-ID: <Z9nqXBd3OjbWZXej@athena.aquini.home> (raw)
In-Reply-To: <20250318174343.243631-1-ryan.roberts@arm.com>
On Tue, Mar 18, 2025 at 05:43:39PM +0000, Ryan Roberts wrote:
> $half_ufd_size_MB is supposed to be half of the available hugetlb memory
> expressed in MB. But previously it was calculated in pages since
> $freepgs is the number of free pages.
>
> When huge pages are 2M it doesn't make a whole lot of difference; the
> number of pages that get used is just halved. But on arm64 with 16K or
> 64K base pages, the PMD size (and default hugetlb size) is 32M and 512M
> respectively. So in this case we end up passing a number of MB that is
> smaller than a single hugetlb page and the test raises an error.
>
> Fixes: 2e47a445d7b3 ("selftests/mm: run_vmtests.sh: fix hugetlb mem size calculation")
> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
> ---
> tools/testing/selftests/mm/run_vmtests.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
> index da7e26668103..14fa9d40d574 100755
> --- a/tools/testing/selftests/mm/run_vmtests.sh
> +++ b/tools/testing/selftests/mm/run_vmtests.sh
> @@ -304,7 +304,7 @@ uffd_stress_bin=./uffd-stress
> CATEGORY="userfaultfd" run_test ${uffd_stress_bin} anon 20 16
> # Hugetlb tests require source and destination huge pages. Pass in half
> # the size of the free pages we have, which is used for *each*.
> -half_ufd_size_MB=$((freepgs / 2))
> +half_ufd_size_MB=$(((freepgs * hpgsize_KB / 2) / 1024))
> CATEGORY="userfaultfd" run_test ${uffd_stress_bin} hugetlb "$half_ufd_size_MB" 32
> CATEGORY="userfaultfd" run_test ${uffd_stress_bin} hugetlb-private "$half_ufd_size_MB" 32
> CATEGORY="userfaultfd" run_test ${uffd_stress_bin} shmem 20 16
> --
> 2.43.0
>
>
this one is already fixed in linux-next, see commit
67a2f86846f2 ("selftests/mm: run_vmtests.sh: fix half_ufd_size_MB calculation")
-- Rafael
prev parent reply other threads:[~2025-03-18 21:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 17:43 Ryan Roberts
2025-03-18 17:43 ` [PATCH v1 2/3] selftests/mm: uffd-unit-tests support for hugepages > 2M Ryan Roberts
2025-03-18 19:54 ` Peter Xu
2025-03-18 21:52 ` Rafael Aquini
2025-03-18 17:43 ` [PATCH v1 3/3] selftests/mm: Speed up split_huge_page_test Ryan Roberts
2025-03-18 19:54 ` Peter Xu
2025-03-18 21:53 ` Rafael Aquini
2025-03-18 19:54 ` [PATCH v1 1/3] selftests/mm: Fix half_ufd_size_MB calculation Peter Xu
2025-03-18 22:05 ` Ryan Roberts
2025-03-18 21:49 ` Rafael Aquini [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=Z9nqXBd3OjbWZXej@athena.aquini.home \
--to=raquini@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=ryan.roberts@arm.com \
--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