Why? I agree that the dirty page support is pretty broken right now (it
really needs a finer-granularity dirty map), but we do want a VM
mapping. The straightforward way to handle it is to just force a "swap
inode" for all anonymous mappings and allocate it all from there.
Also note that we actually do have the reverse mapping information from
physical pages to virtual pages, although it is non-obvious:
page_map -> inode
inode -> vm_area_list
so to find the virtual copy of a physical page you just look up the
inode, and then follow all mappings of that inode (it's not as costly as
it sounds, really).
That also goes for shared swap inodes.
Note that the "swap inode" wouldn't be just _one_ inode, it would be one
inode per process (or rather, per vm) plus one global one (the global
one is needed for shared anonymous mappings which have global semantics
unlike normal anonymous mappings).
I'm not saying the swap inode is trivial to actually implement, but I
think it is the RightWay(tm) to implement this.
"Pages without VM mappings - just say no".
Linus