]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/mm: reimplement is_backed_by_thp() with more precise check
authorZi Yan <ziy@nvidia.com>
Mon, 18 Aug 2025 18:46:20 +0000 (14:46 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 13 Sep 2025 23:55:12 +0000 (16:55 -0700)
commitbd66448f2a0e8da0c7ff01ce2e6dbc2766cf2692
treed589949452d4f449cd8b5d38af97908b038acad8
parent72a07c03909b430b454d7557d2b8fe08b01da42d
selftests/mm: reimplement is_backed_by_thp() with more precise check

and rename it to is_backed_by_folio().

is_backed_by_folio() checks if the given vaddr is backed a folio with
a given order. It does so by:
1. getting the pfn of the vaddr;
2. checking kpageflags of the pfn;

if order is greater than 0:
3. checking kpageflags of the head pfn;
4. checking kpageflags of all tail pfns.

pmd_order is added to split_huge_page_test.c and replaces max_order.

[ziy@nvidia.com: reduce code duplication, per David]
Link: https://lkml.kernel.org/r/F54782D6-65A3-4D35-AE03-8ADE636EE258@nvidia.com
Link: https://lkml.kernel.org/r/20250818184622.1521620-4-ziy@nvidia.com
Signed-off-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: wang lian <lianux.mm@gmail.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Donet Tom <donettom@linux.ibm.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Mariano Pache <npache@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/split_huge_page_test.c
tools/testing/selftests/mm/vm_util.c
tools/testing/selftests/mm/vm_util.h