Skip to content

Commit c9dad08

Browse files
committed
Merge: selftests/mm: run_vmtests.sh: fix half_ufd_size_MB calculation
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6599 JIRA: https://issues.redhat.com/browse/RHEL-74363 This patch is a backport of the following upstream commit: commit 67a2f86 Author: Rafael Aquini <raquini@redhat.com> Date: Tue Feb 18 14:22:51 2025 -0500 selftests/mm: run_vmtests.sh: fix half_ufd_size_MB calculation We noticed that uffd-stress test was always failing to run when invoked for the hugetlb profiles on x86_64 systems with a processor count of 64 or bigger: ... ... not ok 3 uffd-stress hugetlb 128 32 # exit=1 ... The problem boils down to how run_vmtests.sh (mis)calculates the size of the region it feeds to uffd-stress. The latter expects to see an amount of MiB while the former is just giving out the number of free hugepages halved down. This measurement discrepancy ends up violating uffd-stress' assertion on number of hugetlb pages allocated per CPU, causing it to bail out with the error above. This commit fixes that issue by adjusting run_vmtests.sh's half_ufd_size_MB calculation so it properly renders the region size in MiB, as expected, while maintaining all of its original constraints in place. Link: https://lkml.kernel.org/r/20250218192251.53243-1-aquini@redhat.com Fixes: 2e47a44 ("selftests/mm: run_vmtests.sh: fix hugetlb mem size calculation") Signed-off-by: Rafael Aquini <raquini@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Cc: Shuah Khan <shuah@kernel.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Rafael Aquini <raquini@redhat.com> Approved-by: Nico Pache <npache@redhat.com> Approved-by: Herton R. Krzesinski <herton@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents f97a3c7 + f8d7b54 commit c9dad08

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/testing/selftests/mm/run_vmtests.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,9 @@ uffd_stress_bin=./uffd-stress
297297
CATEGORY="userfaultfd" run_test ${uffd_stress_bin} anon 20 16
298298
# Hugetlb tests require source and destination huge pages. Pass in half
299299
# the size of the free pages we have, which is used for *each*.
300-
half_ufd_size_MB=$((freepgs / 2))
300+
# uffd-stress expects a region expressed in MiB, so we adjust
301+
# half_ufd_size_MB accordingly.
302+
half_ufd_size_MB=$(((freepgs * hpgsize_KB) / 1024 / 2))
301303
CATEGORY="userfaultfd" run_test ${uffd_stress_bin} hugetlb "$half_ufd_size_MB" 32
302304
CATEGORY="userfaultfd" run_test ${uffd_stress_bin} hugetlb-private "$half_ufd_size_MB" 32
303305
CATEGORY="userfaultfd" run_test ${uffd_stress_bin} shmem 20 16

0 commit comments

Comments
 (0)