Re: mmap() page swapping location?

From: Rik van Riel (riel@conectiva.com.br)
Date: Mon Jul 31 2000 - 19:46:20 EST


On Tue, 1 Aug 2000, Chris Quinn wrote:

> 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.

There's only one big problem with this. The database will
have to do this "locking" on PAGE granularity, and not on
object granularity.

Also, system call and pagetable / tlb fiddling overhead is
quite high, especially on SMP machines.

Maybe it would be better to copy the "pinned" database
data to separate memory and copy it back to the mmap()ed
region later, when you can flush it out?

(so you do more explicit management on a per-object basis,
you will suffer the cost of copying objects around, but that
is most likely cheaper than working on the page granularity
and doing lots of system calls and expensive TLB operations)

regards,

Rik

--
"What you're running that piece of shit Gnome?!?!"
       -- Miguel de Icaza, UKUUG 2000

http://www.conectiva.com/ http://www.surriel.com/

- 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