Re:Memory is slow, Disk is fast – Part 2
by bawolff on Friday September 05, 2025 @06:06AM
(#45136878)
Trying to google this i found https://lwn.net/Articles/718102/ which suggests that there was discussion about it back in 2017. But i can't find anything else about it except a patchset that i guess wasnt merged (?). So maybe it was just a proposal that never made it in.
Honestly i never knew any of this i thought huge pages just worked for all of mmap.
Re:Memory is slow, Disk is fast – Part 2
by inetknght on Friday September 05, 2025 @01:05PM
(#45140880)
My bad, don't use `MAP_HUGETLB`, just use `MAP_HUGE_1GB`.
See a quick example I whipped up here: https://github.com/inetknght/mmap-hugetlb
Re:Memory is slow, Disk is fast – Part 2
by squirrellous on Saturday September 06, 2025 @03:58AM
(#45147460)
Cool! Thanks for the example. The aforementioned work thing requires MAP_SHARED as well which IIRC is the reason it would fail when used together with files and huge pages, but private mappings work as you show.
Based on this SO discussion [1], it is possibly a limitation with popular filesystems like ext4?
If anyone knows more about this, I'd love to know what exactly are the requirements for using hugepages this way.
[1] https://stackoverflow.com/questions/44060678/huge-pages-for-...