Skip to contentSkip to conversation

mm/mincore: Use can_pte_batch_count() in mincore_pte_range() for pte batch mincore_pte_range()

RFC PATCH zhangqilong 1 participant 1 message Oct 28, 2025 Memory management

lore
Share & tools
lore
#0 lore raw
Quoted 23 lines · Zhang Qilong
Quoted 22 lines

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:

Quoted 8 lines
Quoted 5 lines
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?

Year, the demo case is relatively simple, which may result in stronger continuity of allocated physical page addresses.
This case primarily aims to validate optimization effectiveness in contiguous page address. Maybe we also need watch side effectiveness in non-contiguous page address.

Quoted 10 lines

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