boostorg / boostorg/interprocess
How do i madvise the mapped_region for managed_shared_memory?
- Lingua principale
- C++
- Stelle
- 185
- Fork
- 131
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
For performance reasons we want to preallocate memory in the shared memory by calling madvise(MADV_POPULATE_WRITE). This generally has significant benefit in performance during the bootstrap phase as compared to allocate memory when the memory is accessed. However there are 2 reasons why we cannot do this today:
1. First the managed_shared_memory does not expose the public apis of managed_open_or_create_impl so we are unable to access to api get_mapped_region
2. Even we would have access to the mapped_region, the advise api supports only selected options (enum advice_types) and MADV_POPULATE_WRITE is not part of it.
Do you plan to support this?
I guess the only viable alternative is I separately create the shared_memory and madvise it before initializing using boost's shared_memory something like this:
fd= shm_open("BoostShmem", O_CREATE)
ptr = mmap64(
NULL, fileSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
madvise(ptr, fileSize, MADV_POPULATE_WRITE);
boost::interprocess::managed_shared_memory shared_memory(boost::interprocess::create_only,
"BoostShmem", fileSize);
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia leggendo managed_shared_memory e managed_open_or_create_impl, concentrandoti su come get_mapped_region raggiunge mapped_region e su come vengono gestiti advice_types. Determina il supporto API e di piattaforma necessario per MADV_POPULATE_WRITE; il lavoro è completato quando managed shared memory può esporre la mapped region e applicare questo suggerimento tramite l’interfaccia pubblica.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- operating-systems
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 28/100