Re: how do file-mapped (mmapped) pages become dirty?

From: bill davidsen
Date: Tue Oct 28 2003 - 13:20:28 EST


In article <006901c39d50$0b1313d0$2501a8c0@CARTMAN>,
Amir Hermelin <amir@xxxxxxxxxxxx> wrote:

| When a process mmaps a file, how does the kernel know the memory has been
| written to (and hence the page is dirty)? Is this done by setting the
| protected flag, and when the memory is first written to it's set to dirty?
| What function is responsible for this setting? And when will the page be
| written back to disk (i.e. where's the flusher located)?

At least on x86, the CPU sets the dirty bit on write, although once
upon a time less capable CPUs did it the way you suggest. That said, I
think copy on write is still done the way you suggest, but look at the
code if you really care. Or wait for someone to tell me I'm wrong ;-)

--
bill davidsen <davidsen@xxxxxxx>
CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.
-
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/