2 ms·
Given that Linux now has both file descriptors, and process memory-page ranges, pointing to anonymous allocated memory regions, are they interchangeable? What
by derefr 7y ago
Given that Linux now has both file descriptors, and process memory-page ranges, pointing to anonymous allocated memory regions, are they interchangeable?
What I mean is:
- to go from a memfd to anonymous memory, you can call mmap(2) on the fd
- to go from anonymous memory to a memfd, you...?
- the8472 7y agoSemantically this should do the job: anonymous memory -> vmsplice(gift) -> pipe -> splice(move) -> memfd. Then remap the pages from memfd to the original address ranges so you're allowed to use them again. But I don't know whether this is supported on memfds. And of course it's not atomic.