lkml.org 
[lkml]   [2004]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How to find out which pages were copied-on-write?
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...

> read/write also gives you more explicit control on IO batching and
> scheduling (when to read or write). Less need for the kernel to employ
> tricks to effectively coaslesce IOs on dirtied pages or sense
> streaming access patterns.

But if the kernel would turn a private copy of a c-o-w page into a
"dirty"-page that is marked for writing out to disk, another process
could mmap() the very same page even before it has been written to disk,
while if I write out dirty pages using write() in userspace, other
processes probably won't notice before all the data has reached the disk,
which could take quite some time.

And unlike the user space application, the kernel knows which writes
go to which physical disk so it can e.g. make better use of striping.

Regards,

Lutz Vieweg



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

\
 
 \ /
  Last update: 2005-03-22 14:04    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site