Re: [RFC PATCH 2/3] mm/mincore: Use can_pte_batch_count() in mincore_pte_range() for pte batch mincore_pte_range()
From: David Hildenbrand
Date: Mon Oct 27 2025 - 15:34:24 EST
On 27.10.25 15:03, Zhang Qilong wrote:
In current mincore_pte_range(), if pte_batch_hint() return one
pte, it's not efficient, just call new added can_pte_batch_count().
In ARM64 qemu, with 8 CPUs, 32G memory, a simple test demo like:
1. mmap 1G anon memory
2. write 1G data by 4k step
3. mincore the mmaped 1G memory
4. get the time consumed by mincore
Tested the following cases:
- 4k, disabled all hugepage setting.
- 64k mTHP, only enable 64k hugepage setting.
Before
Case status | Consumed time (us) |
----------------------------------|
4k | 7356 |
64k mTHP | 3670 |
Pathed:
Case status | Consumed time (us) |
----------------------------------|
4k | 4419 |
64k mTHP | 3061 |
I assume you're only lucky in that benchmark because you got consecutive 4k pages / 64k mTHP from the buddy, right?
So I suspect that this will mostly just make a micro benchmark happy, because the reality where we allocate randomly over time, for the PCP, etc will look quite different.
--
Cheers
David / dhildenb