Re: How to find out which pages were copied-on-write?

From: Michael Clark
Date: Tue Jul 13 2004 - 19:26:25 EST


On 07/13/04 23:39, Lutz Vieweg wrote:
Michael Clark wrote:

On 07/13/04 21:04, Lutz Vieweg wrote:

You don't use mmap for speed but rather for convenience.


But isn't an advantage with mmap() that there's no need for the kernel
to copy what is to be written to a dedicated buffer? The kernel
could initiate DMA writes directly from the working memory...


Yes, but page faults are expensive too. Each time a page is written
out it needs to be marked read only again and will cause a page fault
for the next write access from userspace. For certain workloads this
can easily add up to more than copy_(to|from)_user in read/write.


But I would need exactly the same number of pagefaults if I implemented
the "mark-dirty-on-write" logic in userspace using SIGSEGV and signal
handlers, as it is done by the LPSM software...

Yes, that's sort of my point although you get the commit semantics
you want, albeit a little more usersapce signal overhead and an mprotect
call (you've already taken the exception so the extra signal overhead
shouldn't be too much), but perhaps less overall page faults than
MAP_SHARED (which is the mmap variant that writes dirtied pages back
to backing store) as you control when to mark the page clean again
ie. do the writeout at your commit point and not before.

Really my point was you don't use mmap for speed but rather for convenience.

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