Catching when the linux kernel writes a page back to a memory mapped file?
===

I'm contemplating a system that would let me memory map files and transparently do type conversion on the data they contain.  It seems it's possible to catch memory accesses by mmaping a second memory region and making it protected, then catching the segfault a new page is accessed.  This would let me handle the on-read type conversion I need.

However, to be read/write compatibly, I'd need some way to catch when the OS is paging part of the memory back to disk so I could do the type conversion the other way before it's written. 

Is there any capability for hooking the paging system in this way?