[PATCH v2 00/13] selftests/mm: fix failures and robustness improvements
Venkat Rao Bagalkote
venkat88 at linux.ibm.com
Tue Mar 17 17:00:25 AEDT 2026
On 13/03/26 7:46 pm, Sayali Patil wrote:
>
> On 13/03/26 03:35, Andrew Morton wrote:
>> On Thu, 12 Mar 2026 17:55:27 +0530 Sayali Patil
>> <sayalip at linux.ibm.com> wrote:
>>
>>> Hi all,
>>>
>>> Powerpc systems with a 64K base page size exposed several issues while
>>> running mm selftests. Some tests assume specific hugetlb
>>> configurations,
>>> use incorrect interfaces, or fail instead of skipping when the required
>>> kernel features are not available.
>>>
>>> This series fixes these issues and improves test robustness.
Hello Sayali,
I still see, below test failure. Apart from this, everyting else is
working as expected.
# # ------------------------------------------------
# # running ./hugetlb_reparenting_test.sh -cgroup-v2
# # ------------------------------------------------
# # cleanup
# #
# # Test charge, rmdir, uncharge
# # mkdir
# # write
# # Writing to this path: /mnt/huge/test
# # Writing this size: 26843545600
# # Populating.
# # Not writing to memory.
# # Using method=0
# # Shared mapping.
# # RESERVE mapping.
# # Allocating using HUGETLBFS.
# #
# # rmdir
# # uncharge
# # cleanup
# # done
# #
# #
# # Test child only hugetlb usage
# # setup
# # write
# # Writing to this path: /mnt/huge/test2
# # Writing this size: 26843545600
# # Populating.
# # Not writing to memory.
# # Using method=0
# # Shared mapping.
# # RESERVE mapping.
# # Allocating using HUGETLBFS.
# #
# # Assert memory charged correctly for child only use.
# # actual = 11 MB
# # expected = 0 MB
# # FAIL
# # cleanup
# # [FAIL]
# not ok 12 hugetlb_reparenting_test.sh -cgroup-v2 # exit=1
Regards,
Venkat.
>> Thanks, I updated mm.git's mm-new branch to this version.
>>
>>> ---
>>> v1->v2
>>> - For "selftests/mm: ensure destination is hugetlb-backed in
>>> hugepage-mremap":
>>> update FLAGS definition to MAP_HUGETLB | MAP_SHARED |
>>> MAP_POPULATE and
>>> used it for mmap() calls as suggested during review.
>> That was a really small change (below). It's better to wait a while
>> (half to one week) before resending an entire series. So as to
>> hopefully accumulate more changes.
>>
>>
>>
>> --- a/tools/testing/selftests/mm/hugepage-mremap.c~b
>> +++ a/tools/testing/selftests/mm/hugepage-mremap.c
>> @@ -31,7 +31,7 @@
>> #define MB_TO_BYTES(x) (x * 1024 * 1024)
>> #define PROTECTION (PROT_READ | PROT_WRITE | PROT_EXEC)
>> -#define FLAGS (MAP_SHARED | MAP_ANONYMOUS)
>> +#define FLAGS (MAP_HUGETLB | MAP_SHARED | MAP_POPULATE)
>> static void check_bytes(char *addr)
>> {
>> @@ -121,23 +121,20 @@ int main(int argc, char *argv[])
>> /* mmap to a PUD aligned address to hopefully trigger pmd
>> sharing. */
>> unsigned long suggested_addr = 0x7eaa40000000;
>> - void *haddr = mmap((void *)suggested_addr, length, PROTECTION,
>> - MAP_HUGETLB | MAP_SHARED | MAP_POPULATE, fd, 0);
>> + void *haddr = mmap((void *)suggested_addr, length, PROTECTION,
>> FLAGS, fd, 0);
>> ksft_print_msg("Map haddr: Returned address is %p\n", haddr);
>> if (haddr == MAP_FAILED)
>> ksft_exit_fail_msg("mmap1: %s\n", strerror(errno));
>> /* mmap again to a dummy address to hopefully trigger pmd
>> sharing. */
>> suggested_addr = 0x7daa40000000;
>> - void *daddr = mmap((void *)suggested_addr, length, PROTECTION,
>> - MAP_HUGETLB | MAP_SHARED | MAP_POPULATE, fd, 0);
>> + void *daddr = mmap((void *)suggested_addr, length, PROTECTION,
>> FLAGS, fd, 0);
>> ksft_print_msg("Map daddr: Returned address is %p\n", daddr);
>> if (daddr == MAP_FAILED)
>> ksft_exit_fail_msg("mmap3: %s\n", strerror(errno));
>> suggested_addr = 0x7faa40000000;
>> - void *vaddr = mmap((void *)suggested_addr, length, PROTECTION,
>> - MAP_HUGETLB | MAP_SHARED | MAP_POPULATE, fd, 0);
>> + void *vaddr = mmap((void *)suggested_addr, length, PROTECTION,
>> FLAGS, fd, 0);
>> ksft_print_msg("Map vaddr: Returned address is %p\n", vaddr);
>> if (vaddr == MAP_FAILED)
>> ksft_exit_fail_msg("mmap2: %s\n", strerror(errno));
>> _
>>
>>
> Thanks for the guidance. I'll make sure to follow this approach from
> next time.
>
More information about the Linuxppc-dev
mailing list