3 ms·
> Don’t create any file backed writable memory mappings If you have to create a writable file-backed memory mapping, open it in /dev/shm or /dev/hugepages. You
by ncmncm 6y ago
> Don’t create any file backed writable memory mappings
If you have to create a writable file-backed memory mapping, open it in /dev/shm or /dev/hugepages. You can mount your own hugetlbfs volume with the right permissions.
Creating a big-ass single-writer ring buffer in a series of mapped hugetlb pages is a great way to give downstream code some breathing room. You can have multiple downstream programs, each on its own core, map it read-only, and start and stop them independently. Maintain a map of checkpoints farther back in the ring buffer, and they can pick up again, somewhere back, without missing anything.
- rigtorp 6y agoI don't consider that file backed since they pull memory from the same pool as anonymous memory and not the page cache. The Linux kernel docs makes the distinction between file backed and anonymous memory. I think a better term would probably be page cached backed memory vs anonymous memory.
- rigtorp 6y agoYou might be interested in https://rigtorp.se/virtual-memory/ https://rigtorp.se/virtual-memory/ where I look deeper at the VM subsystem.