On Thu, Sep 26, 2024 at 05:20:43PM +0200, David Hildenbrand wrote:
We currently assume that the hugetlb page size is 2 MiB, which is why we mmap() a 2 MiB range.
Is the default hugetlb size is larger, mmap() will fail because the range is not suitable. If the default hugetlb size is smaller (e.g., s390x), mmap() will fail because we would need more than one hugetlb page, but just asserted that we have exactly one.
So let's simply use the default hugetlb page size instead of hard-coded 2 MiB, so the test isn't unconditionally skipped on architectures like s390x.
Before this patch on s390x: $ ./hugetlb_fault_after_madv 1..0 # SKIP Failed to allocated huge page
With this change on s390x: $ ./hugetlb_fault_after_madv
While at it, make "huge_ptr" static.
Reported-by: Mario Casquero mcasquer@redhat.com Signed-off-by: David Hildenbrand david@redhat.com
Reviewed-by: Breno Leitao leitao@debian.org