> is_backed_by_folio() answers "what order folio backs this page", but > mTHP collapse tests need the range-level question: is every > order-aligned window of this VA range backed by one folio of exactly
Nit: ^ address (even without Virtual) reads better to me here and in the subject. > that order, mapped head-to-tail? > > Add is_range_backed_by_folio_orders(): per window, require a present > and naturally aligned head PFN, a contiguous PFN run across the > window, and is_backed_by_folio() agreeing on the order. A window > assembled from pieces of different folios, or mapping a folio outside > its natural position, fails the check. I'd need claude to understand this one ;-P > Assisted-by: Claude-Code:claude-opus-5 > Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]> > > diff --git a/tools/testing/selftests/mm/vm_util.c > b/tools/testing/selftests/mm/vm_util.c > index 343a15e25a9f..793342095420 100644 > --- a/tools/testing/selftests/mm/vm_util.c > +++ b/tools/testing/selftests/mm/vm_util.c > @@ -365,6 +365,52 @@ bool is_backed_by_folio(char *vaddr, int order, int > pagemap_fd, > return false; > } > > +/* > + * Check whether the range [start, start + len) is backed by folios of > + * exactly @order, mapped at their natural alignment. > + * > + * is_backed_by_folio() classifies the folio backing one page; here we > + * additionally require that each order-aligned window of the range maps I don't think the description should be incremental on top of is_backed_by_folio() > + * one such folio head-to-tail: the VA range must be naturally aligned, Please spell out VA or just use "address". selftests are userspace, "virtual" is kinda implied. -- Sincerely yours, Mike.

