Re: follow_page()

Arjan van de Ven
2004-11-11T11:10:53Z

> > most likely it's because the intent to write to it is given.
> > It's cheaper for the OS to mark a pagetable dirty than it's for the CPU
> > to do so (example, on a Pentium 4 it can easily take the cpu 2000 to
> > 4000 cycles to flip the dirty bit on the PTE). So if you KNOW you're
> > going to write to it (and thus the intent parameter) you can save a big
> > chunk of those cycles.
>
> But it's racy. writeback can write-and-clean the page before we've
> modified its contents. Whether the page contents are altered via disk DMA
> or a memset or whatever, we can lose the data. Except callers are
> correctly dirtying the page after modifying it anyway.

so in the race case you get the hit of those 4000 cycles... still optimizes the non-race case
(so I'd agree that nothing should depend on this function dirtying it; it's a pre-dirty that's an
optimisation)