Re: [rfc][patch] mm: dirty page accounting hole

Nick Piggin
2008-08-12T13:17:12Z

On Tuesday 12 August 2008 21:53, Nick Piggin wrote:
> On Tuesday 12 August 2008 21:15, Hugh Dickins wrote:
> > On Tue, 12 Aug 2008, Nick Piggin wrote:
> > > I think I'm running into a hole in dirty page accounting...
> > >
> > > What seems to be happening is that a page gets written to via a
> > > VM_SHARED vma. We then set the pte dirty, then mark the page dirty.
> > > Next, mprotect changes the vma so it is no longer writeable so it
> > > is no longer VM_SHARED. The pte is still dirty.
> >
> > I don't think you've got that right yet.
> >
> > mprotect can of course change vma->vm_flags to take VM_WRITE off,
> > making vma no longer writeable; but it shouldn't be touching
> > VM_SHARED. And a quick check with debugger confirms that.
>
> Drat, yes, I must have been thinking of VM_WRITE vs VM_MAYWRITE.

And indeed I was able to reproduce the problem with my "fix" applied
too, after refining the test case to be more reproduceable...