[PATCH v2 00/13] selftests/mm: fix failures and robustness improvements

Sayali Patil sayalip at linux.ibm.com
Sat Mar 14 01:16:58 AEDT 2026


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.
> 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