Ashmem is a kernel feature written by Robert Love: http://lwn.net/Articles/452035/
Problems:
- It's pages are shrunk by memory pressure via the slab shrinkers. But the pages are not on the normal VM LRU lists. So, they are not ordered the same and do not have the same reclaim behavior
- The patch is only in Android kernels at the moment
Imagine what would happen if we took a tmpfs page and instead of swapping it out, we simply discard it. It would be on all the LRUs, but would behave quite a bit like an ashmem unpinned page. For instance: http://sr71.net/~dave/linux/do-tmpfs-now.patch
How do we reimplement ashmem's unpinned ranges?
- Can not use mlock() since the file might not always be mapped
- VMA structure is nice because it can easily be stored in an rb-tree and the code also handles splits/merges, but it's probably too heavyweight to break out on its own
- flock() and fcntl() both have fd-based lock mechanisms, can those be repurposed?