On 6/12/26 6:32 PM, Nico Pache wrote:


On 6/10/26 4:29 AM, Baolin Wang wrote:
To support checking for various sized mTHPs during mTHP collapse, extend the
check_huge() function prototype to accept two new parameters specifying the
address range and mTHP size, in preparation for the following patches.

No functional changes.

Signed-off-by: Baolin Wang <[email protected]>
---
  .../selftests/mm/folio_split_race_test.c      |  2 +-
  tools/testing/selftests/mm/khugepaged.c       | 66 ++++++++++---------
  .../testing/selftests/mm/prctl_thp_disable.c  |  2 +-
  tools/testing/selftests/mm/soft-dirty.c       |  2 +-
  .../selftests/mm/split_huge_page_test.c       | 14 ++--
  tools/testing/selftests/mm/uffd-common.c      |  4 +-
  tools/testing/selftests/mm/vm_util.c          |  6 +-
  tools/testing/selftests/mm/vm_util.h          |  6 +-
  8 files changed, 55 insertions(+), 47 deletions(-)


[snip]

diff --git a/tools/testing/selftests/mm/vm_util.c 
b/tools/testing/selftests/mm/vm_util.c
index 311fc5b4513e..b43adfa92116 100644
--- a/tools/testing/selftests/mm/vm_util.c
+++ b/tools/testing/selftests/mm/vm_util.c
@@ -247,17 +247,17 @@ bool __check_huge(void *addr, char *pattern, int 
nr_hpages,
        return thp == (nr_hpages * (hpage_size >> 10));
  }
-bool check_huge_anon(void *addr, int nr_hpages, uint64_t hpage_size)
+bool check_huge_anon(void *addr, unsigned long size, int nr_hpages, uint64_t 
hpage_size)

Whats the purpose of adding 'size' here?

  {
        return __check_huge(addr, "AnonHugePages: ", nr_hpages, hpage_size);
  }
-bool check_huge_file(void *addr, int nr_hpages, uint64_t hpage_size)
+bool check_huge_file(void *addr, unsigned long size, int nr_hpages, uint64_t 
hpage_size)
  {
        return __check_huge(addr, "FilePmdMapped:", nr_hpages, hpage_size);

Same?

  }
-bool check_huge_shmem(void *addr, int nr_hpages, uint64_t hpage_size)
+bool check_huge_shmem(void *addr, unsigned long size, int nr_hpages, uint64_t 
hpage_size)
  {
        return __check_huge(addr, "ShmemPmdMapped:", nr_hpages, hpage_size);

And here?

Perhaps I find out in the next patch :)

This is to specify the address range, so that when calling gather_folio_orders(), it can count the number of hugepages within that range.

Reply via email to