mbox series

[v1,0/2] selftests/mm: hugetlb_fault_after_madv improvements

Message ID 20240926152044.2205129-1-david@redhat.com
Headers show
Series selftests/mm: hugetlb_fault_after_madv improvements | expand

Message

David Hildenbrand Sept. 26, 2024, 3:20 p.m. UTC
Mario brought to my attention that the hugetlb_fault_after_madv test
is currently always skipped on s390x.

Let's adjust the test to be independent of the default hugetlb page size
and while at it, also improve the test output.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Mario Casquero <mcasquer@redhat.com>
Cc: Breno Leitao <leitao@debian.org>

David Hildenbrand (2):
  selftests/mm: hugetlb_fault_after_madv: use default hguetlb page size
  selftests/mm: hugetlb_fault_after_madv: improve test output

 .../selftests/mm/hugetlb_fault_after_madv.c   | 48 ++++++++++++++++---
 1 file changed, 42 insertions(+), 6 deletions(-)

Comments

Breno Leitao Sept. 30, 2024, 10:01 a.m. UTC | #1
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>
Mario Casquero Oct. 1, 2024, 10:31 a.m. UTC | #2
This series has been successfully tested. Now when executing the
hugetlb_fault_after_madv selftest the benefits of both patches could
be observed.
# ./hugetlb_fault_after_madv
TAP version 13
1..1
# [INFO] detected default hugetlb page size: 1024 KiB
ok 1 SIGBUS behavior
# Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0

Tested-by: Mario Casquero <mcasquer@redhat.com>


On Thu, Sep 26, 2024 at 5:20 PM David Hildenbrand <david@redhat.com> wrote:
>
> Mario brought to my attention that the hugetlb_fault_after_madv test
> is currently always skipped on s390x.
>
> Let's adjust the test to be independent of the default hugetlb page size
> and while at it, also improve the test output.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: Mario Casquero <mcasquer@redhat.com>
> Cc: Breno Leitao <leitao@debian.org>
>
> David Hildenbrand (2):
>   selftests/mm: hugetlb_fault_after_madv: use default hguetlb page size
>   selftests/mm: hugetlb_fault_after_madv: improve test output
>
>  .../selftests/mm/hugetlb_fault_after_madv.c   | 48 ++++++++++++++++---
>  1 file changed, 42 insertions(+), 6 deletions(-)
>
> --
> 2.46.1
>