On Tue, Aug 18, 2026 at 11:30:06AM +0100, Lorenzo Stoakes (ARM) wrote: > On Sat, Aug 15, 2026 at 02:58:51AM +0100, Kiryl Shutsemau wrote: > > From: "Kiryl Shutsemau (Meta)" <[email protected]> > > > > The khugepaged mTHP tests detect collapse results with the vm_util > > folio-order helpers rather than smaps AnonHugePages, which only sees PMD > > mappings. If those helpers are wrong, every case built on them is wrong > > the same way, and nothing says so. > > > > Check them directly. For every anon THP order the kernel supports, fault > > memory in with only that order enabled. Require the helpers to classify > > the backing as exactly that order: not a neighbouring order, and 4K-backed > > memory as order 0. > > > > Run it in the thp category, ahead of ./khugepaged, so a broken helper is > > reported as itself rather than as a collapse failure. Verified on x86-64 > > 4K (orders 0, 2-9) and arm64 64K (orders 0, 2-13). > > > > The test needs ALIGN(), which hmm-tests.c and migration.c each defined > > privately. Move it to vm_util.h and drop both copies. > > Also: > > uffd-unit-tests defines ALIGN_UP()... > > And really you probably want to match the kernel convention of ALIGN() > defaulting to align-up (for some reason) and name this ALIGN_DOWN() to be > consistent and avoid confusion BUT...
Hm? It is align-up: #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) It matches kernel definition. pkey-helpers.h has ALIGN_UP(), ALIGN_DOWN() and two pointer variants of its own. Folding those onto the vm_util.h one is worth doing, as a follow-up rather than in this series. -- Kiryl Shutsemau / Kirill A. Shutemov

