Pool recycling of pageout'd regions: validate syscall costs and residency semantics
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- linux, rust
- Ambito
- operating-systems, performance
Direzione di ricerca
Start at ThreadLocalStealer::deallocate and run the listed experiments across the representative allocation sizes, measuring first-touch time, mincore residency, AnonHugePages in /proc/self/smaps, and syscall overhead for each advisory. Done means comparing the four mitigation proposals on Linux 5.15+ and recording whether the data supports a runtime change or documentation-only approach.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Context
When a user allocates a region, writes to it, calls pageout (MADV_PAGEOUT), and then deallocates, the pool recycles the (now-cold) allocation. The next caller that writes to the recycled region pays page-fault cost on first access. The pool's implicit contract ("cheap to re-hand-out") is violated silently.
Current deallocation path:
- Drop routes through
ThreadLocalStealer::deallocate→ worker queue. - Eventually either handed out again, or moved to the global injector and later cleared by the background worker via
MADV_FREE(Linux) /MADV_DONTNEED(other). MADV_FREEon pageout'd pages is a no-op — the pages are already gone.
Pages can also lose THP backing silently. MADV_COLD / MADV_PAGEOUT may split a transparent huge page to operate on a sub-range; splits are not automatically reversed.
Experiments to run
Measure, in isolation, with representative allocation sizes (2 MiB, 16 MiB, 128 MiB, 1 GiB):
- Baseline write cost on a freshly-mmaped anonymous region with
MADV_HUGEPAGE: first-touch fault cost, bandwidth for full write-through. - Post-
MADV_PAGEOUTcost: pageout a resident region, re-write it. Measure fault cost and whether THP is still in effect (/proc/self/smaps→AnonHugePages). - Post-
MADV_COLDcost: same, but just marking cold. Does re-touch rebuild THP? - Post-
MADV_DONTNEEDcost: does the kernel re-fault into huge pages, or small pages? - Post-
MADV_FREE(then reclaimed) cost: pressure the kernel into reclaiming, then re-touch. - Syscall overhead of
MADV_DONTNEED/MADV_FREE/mincoreper call, as a function of region size.
Track per-scenario:
- Time to first-touch the region after the advisory.
- Residency after re-touch (via
mincore). - Huge-page status after re-touch.
Mitigation proposals to compare
- Every dealloc runs
MADV_DONTNEEDon the region before it re-enters the pool. Guarantees the next caller faults into fresh (presumably THP-backed) pages. Costs one syscall per dealloc.- Open question: after
MADV_DONTNEED, does the next touch fault into a huge page, or small pages? Empirically the kernel has flip-flopped on this across versions.
- Open question: after
MADV_DONTNEEDonly on promotion to the global injector. Thread-local reuse skips it (fast path for allocate-then-dealloc-then-allocate within one thread). Cross-thread handoffs pay the cost.mincore-gated decision. Callmincorefirst; onlyMADV_DONTNEEDif a significant fraction of the region is non-resident (heuristic: user recently pageout'd). Adds a syscall but may be cheaper than unconditionalMADV_DONTNEEDon huge regions.- Status quo + documentation.
pageout's doc warns callers that deallocating a pageout'd region hands cold memory to the next caller. No runtime mitigation.
Decision inputs
- Absolute syscall cost vs. absolute page-fault cost at representative sizes.
- Whether
MADV_DONTNEEDreliably rebuilds THP on re-touch under current kernels (5.15+ target). - Whether
mincore's cost scales acceptably for our size classes (up to 128 GiB).
Scope
Investigation only for 0.1.x. If experiments point to a clear winner, ship the mitigation in a minor release. Until then, rely on the (yet-to-add) doc warning on pageout.
- Lingua principale
- Rust
- Stelle
- 0
- Fork
- 0
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
Choochmeque/tauri-plugin-webdriver#134 ·
I maintainer di solito rispondono entro 17 giorni
-
bug(c-sdk): boxlite_box_exec does not check runtime liveness before dispatching streaming execApertabug rust SDK & CLI & REST API
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
boxlite-ai/boxlite#3292 ·
I maintainer di solito rispondono entro 1 giorno
-
Android bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
anefzaoui/misterdownloadmanager#2516 ·
I maintainer di solito rispondono entro 1 giorno
-
editor ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
state:triage tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 89/100
agent8-cash/ethpayserver#731 ·
I maintainer di solito rispondono entro 1 giorno