Re: [PATCH v3 2/3] selftests/mm: remove hardcoded THP sizing assumptions in hmm tests
From: Balbir Singh
Date: Fri Jun 12 2026 - 04:23:10 EST
On Thu, Jun 11, 2026 at 09:11:01AM +0530, Aboorva Devarajan wrote:
> From: Sayali Patil <sayalip@xxxxxxxxxxxxx>
>
> migrate_partial_unmap_fault() and migrate_remap_fault() use
> hardcoded offsets based on a 2MB PMD size. Similarly,
> benchmark_thp_migration() assumes a fixed 2MB THP size when generating
> test buffer sizes.
>
> Derive offsets and test sizes from the runtime PMD page size returned
> by read_pmd_pagesize(). If unavailable, fall back to TWOMEG.
> This allows the tests to adapt correctly on systems where
> PMD-sized THP differs from 2MB. Also replace the fixed 1MB unmap
> size with a PMD-relative value derived from the runtime PMD size.
>
> On systems with larger PMD sizes, computed test buffer sizes can exceed
> INT_MAX. Skip such test cases to avoid overflow.
>
> Fixes: 24c2c5b8ffbd ("selftests/mm/hmm-tests: partial unmap, mremap and anon_write tests")
> Fixes: 271a7b2e3c13 ("selftests/mm/hmm-tests: new throughput tests including THP")
> Signed-off-by: Sayali Patil <sayalip@xxxxxxxxxxxxx>
> Signed-off-by: Aboorva Devarajan <aboorvad@xxxxxxxxxxxxx>
> ---
Thanks,
Acked-by: Balbir Singh <balbirs@xxxxxxxxxx>