special handling of page faults

bhalios . babisel10 at gmail.com
Mon Oct 5 10:19:59 EDT 2015


Hello all,

I am investigating alternative ways of swapping memory. For my purposes I
have a kernel module that emulates a device in which I can write memory
pages temporarily.


I have two events that I m interested in, both of them might occur during
the page fault handling. The first case is sending the victim page (more
accurately the victim pages of a vm_area_struct) during a page fault to
this device instead of the disk. At this time a special flag will be set
that will mark the pages of the memory region as present to the particular
device. The second case is when, during a page fault I find out that the
pages I m looking for are located to the device, and I need to bring them
back to the main memory (as I would with normal swapping in).

I'm working with kernel 2.6.32 and I ve read quite a lot in Understanding
the Linux Kernel (there are some slight changes to the memory subsystem
comparing to the 2.6.11 that the book presents) and I think I know where I
should hook my code.

For now I m only interested in the kind of memory that is allocated through
a malloc or an mmap with anonymous mapping from the user space, not file
mappings, DMA or kernel data.

My question is:

Which is the cleanest way to do so? Is there a way to do it, using a module
and not touching kernel code? Are there any hooks to that part of the
memory subsystem? (From what I was able to understand, there is not an
interface that allows me to alter the way page faults are handled).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151005/a25fad9a/attachment.html 


More information about the Kernelnewbies mailing list