About ten years ago, Emery Berger proposed a VM-friendly garbage collection strategy that required the application to know which pages were in memory. For testing purposes, he and his students released a kernel patch that notified the swap event application using real-time signals, allowing the garbage collector to save its own database of resident pages. (Although this seems like duplication of effort, it is much more efficient than several system calls to get information every time it is needed.)
You can find information about this interesting study on the page.
As far as I know, there is no implementation of this patch for the latest Linux kernel, but you could always resurrect it.
source share