Re: [rfc][patch] mm: dirty page accounting race fix

Hugh Dickins
2008-08-14T13:20:37Z

On Thu, 14 Aug 2008, Nick Piggin wrote:
> On Thu, Aug 14, 2008 at 12:55:46PM +0100, Hugh Dickins wrote:
>
> Maybe I've found another one: ppc64's set_pte_at seems to clear
> the pte, and lots of pte accessors are implemented with set_pte_at.
> mprotect's modify_prot_commit for example.
>
> Even if I'm wrong and we happen to be safe everywhere, it seems
> really fragile to ask that no architectures ever allow transient
> !pte_present in cases where it matters, and no generic code
> emit the wrong sequence either. Or is there some reason I'm missing
> that makes this more robust?

I agree completely that should be allowed (within pagetable lock)
and is sometimes essential, mprotect being the classic example.

So I'll try to think through your case later on, focussing on
mprotect instead, and report back once I've pictured it.

> Hmm, vma_wants_writenotify is only true if VM_WRITE, and in that
> case we might be OK?

Yes, that's what I'd missed: with that worry out of the way,
I should think a bit clearer.

Hugh