lkml.org 
[lkml]   [2000]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectmmap() page swapping location?
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/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.056 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site