Commit f0bf91a
committed
Add size-gated hugepage optimization to system allocator
This patch adds optional hugepage optimization by applying madvise(MADV_HUGEPAGE)
to allocations that are large enough to benefit from transparent hugepages.
Current behavior:
- Uses MADV_NOHUGEPAGE for infrequent access patterns, MADV_HUGEPAGE only for memory collapsing
- No proactive hugepages for large allocations
Enhanced behavior:
- Adds MADV_HUGEPAGE for allocations >= kHugePageSize (2MB)
- Only applies to allocations that can actually benefit from hugepages
- Avoids kernel overhead on small allocations
The size threshold ensures we only hint hugepage usage for allocations
that can actually be backed by hugepages, avoiding unnecessary kernel
overhead for smaller allocations.1 parent 7c90c4d commit f0bf91a
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
380 | 389 | | |
381 | 390 | | |
382 | 391 | | |
| |||
0 commit comments