mmap() page swapping location?

From: Chris Quinn (cq@htec.demon.co.uk)
Date: Mon Jul 31 2000 - 19:10:49 EST


Hello folks,

I'm attempting to implement a database and in order to get a crash recovery scheme it's necessary to prevent modified mmap()'ed pages being flushed out to disk before the undo log is synced. One way to do this is via the mlock() call but it requires root privelege and is in any case overkill. What I thought would do the trick is to add a MAP_SWAP flag to mmap() to indicate that a dirty page should be swapped out not to the private file but to the swap device.
I think try_to_swap_out() in mm/vmscan.c is the place to check vm_flag and act accordingly. I believe that dirty mmap()'ed pages are as likely to be considered for swapping as dirty pages of malloc()'ed data.
This is good news if true, but is it?

The counterpart to this is when a process re-accesses the page; as far as I have been able to ascertain the pte is examined, swap status noticed and page reloaded, rather than nopage() called (which I don't want.)
Is this true?

The bit that worries me is when a dirty page is swapped out when msync() is called or fsync() on the descriptor; I don't think I'll have any luck assuming linux will automatically reload from swap and write back out to the file.
Am I out of luck on this?

This seems to me a rather useful feature and so I wonder if there isn't already some other tried and tested mechanism for achieving the same thing!

Thanks,
Chris Quinn

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:35 EST