On Thu, Sep 10, 2026 at 01:14:42PM +0200, David Hildenbrand (Arm) wrote:
> On 9/10/26 13:02, Yeoreum Yun wrote:
> >>> diff --git a/tools/testing/selftests/mm/soft-dirty.c 
> >>> b/tools/testing/selftests/mm/soft-dirty.c
> >>> index 5f278913c4d7..b6fad38c8bee 100644
> >>> --- a/tools/testing/selftests/mm/soft-dirty.c
> >>> +++ b/tools/testing/selftests/mm/soft-dirty.c
> >>> @@ -92,9 +92,9 @@ static void test_hugepage(int pagemap_fd, int pagesize)
> >>>   if (!hpage_len)
> >>>           ksft_exit_fail_msg("Reading PMD pagesize failed");
> >>>  
> >>> - map = memalign(hpage_len, hpage_len);
> >>> + map = alloc_isolated_mem(hpage_len, hpage_len);
> >>>   if (!map)
> >>> -         ksft_exit_fail_msg("memalign failed\n");
> >>> +         ksft_exit_fail_msg("alloc_isolated_mem failed\n");
> >>>  
> >>>   ret = madvise(map, hpage_len, MADV_HUGEPAGE);
> >>>   if (ret)
> >>> @@ -130,7 +130,7 @@ static void test_hugepage(int pagemap_fd, int 
> >>> pagesize)
> >>>           ksft_test_result_skip("Test %s huge page allocation\n", 
> >>> __func__);
> >>>           ksft_test_result_skip("Test %s huge page dirty bit\n", 
> >>> __func__);
> >>>   }
> >>> - free(map);
> >>> + free_isolated_mem(map, hpage_len);
> >>>  }
> >>
> >> smaps is really only problematic with merged VMAs when relying on exact 
> >> page
> >> statistics. For other properties (vm flags, MMUPageSize) it's not a 
> >> problem as
> >> long as our smap search just finds the VMA that covers an address.
> >>
> >> Assuming we fixed check_huge_anon() to not use smaps, why is this change 
> >> here
> >> required?
> > 
> > Since there is no interface to get vm_flags not via /proc/self/smaps,
> > It might be good to have it for preventing unwanted VMA merge.
> > 
> > And might be useful for future to prevent unwated VMA merge.
> 
> See my reply on why vm flags are generally not a problem. Just like other
> properties that are not changed during VMA merging.
> 
> Let's not perform random code changes without a clear picture.
> 
> And just to emphasize again: VMA merging could already be a problem before
> memalign() internal changes.
> 
> (also observe here how we do a MADV_HUGEPAGE, so this is all rather arbitrary,
> which is not good)

As I mentioned in my previous reply, what I’m trying to prevent here is
a failure when checking, immediately after memory allocation,
that a specific vm_flag is not set.

Yes, I agree that this could have been a problem even before
the internal changes to memalign(). An unwanted VMA merge could already
occur at the time of memory allocation.

So what I’m trying to avoid is a test failure where, due to such an
unexpected VMA merge during allocation, the subsequent check that
a specific vm_flag is not present fails.

I probably didn’t explain this clearly enough and ended up causing
more confusion. Sorry about that.

-- 
Sincerely,
Yeoreum Yun

Reply via email to