Here's what I'd like to do: put a file on tmpfs but ensure that all of it (all pages of it) ends up on the same NUMA node. First, I thought this would be trivial: I'd just mmap() a tmpfs file with MAP_SHARED and then use mbind() to tie it to the node I want and then I just copy. However, mbind()'s man page explicitly excludes this approach:NUMA policy is not supported on a memory-mapped file range that was mapped with the MAP_SHARED flag.Blimey! The mbind() man page says that for shared mappings, I can only rely on the process memory policy (using set_mempolicy()). But that's far from ideal: I'm running a heavily multi-threaded application and I'd rather not care which thread is doing the copying. I'd rather the memory policy was tied to the tmpfs file instead, making my life easier.Anybody has any ideas on how to solve this problem?
Using shared memory through tmpfs and NUMA on x86_64/Linux
linux;tmpfs;mmap;numa