Question

Will mmaping in a tmpfs volume in linux cause active pages to be stored in RAM twice? My understanding is that the kernel uses a special shmem_mmap operation for mapping ramdisks so each page only consumes resources once. But I'm on a xen virtual machine and I assume xen messes with virtual memory operations as well.

Context: I'm experimenting with mongodb on a tmpfs volume in AWS (i.e. on a xen virtual machine).

Was it helpful?

Solution

Active tmpfs pages are not stored twice (that would be extremely wasteful for large tmpfs). You may want to read over the tmpfs docs at kernel.org, in particular for mongo "If you oversize your tmpfs instances the machine will deadlock since the OOM handler will not be able to free that memory." I'm not following you about "mmaping in a tmpfs volume," but I assume you mean the filesystem doing the memory mapping and not a process, which would just write to the filesystem like with any block device.

Also seems like you've got a hidden question in there about Xen and virtual memory, I recommend also reading Brendan Gregg's Xen Feature Detection post (you want "page tables") and perhaps taking a look at Intel's Virtualization Technology site since as of today in mid-2014, AWS says they use Intel Sandy Bridge and Ivy Bridge on the EC2 Instance Types page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top