Re:Memory is slow, Disk is fast – Part 2
by inetknght on Thursday September 04, 2025 @07:54PM
(#45133578)
> I'd have look into that. Off the top of my head I don't know how you'd make that happen.
Pass these flags to your mmap call: (MAP_HUGETLB | MAP_HUGE_1GB)
Re:Memory is slow, Disk is fast – Part 2
by jared_hulbert on Thursday September 04, 2025 @08:02PM
(#45133626)
Would this actually create huge page page cache entries?
Re:Memory is slow, Disk is fast – Part 2
by inetknght on Thursday September 04, 2025 @08:11PM
(#45133675)
It's right in the documentation for mmap() [0]! And, from my experience, using it with an 800GB file provided a significant speed-up, so I do believe the documentation is correct ;)
And, you can poke around in the linux kernel's source code to determine how it works. I had a related issue that I ended up digging around to find the answer to: what happens if you use mremap() to expand the mapping and it fails; is the old mapping still valid or not? Answer: it's still valid. I found that it was actually fairly easy to read linux kernel C code, compared to a lot (!) of other C libraries I've tried to understand.
But the arm64 systems with 16K or 64K native pages would have fewer faults.