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

Hugh Dickins
2008-08-14T13:39:02Z

On Thu, 14 Aug 2008, Peter Zijlstra wrote:
> On Thu, 2008-08-14 at 12:55 +0100, Hugh Dickins wrote:
>
> > But holding the page table lock on one pte of the
> > page doesn't guarantee much about the integrity of the whole dance:
> > do_wp_page does its set_page_dirty_balance for this case, you'd
> > need to spell out the bad sequence more to convince me.
>
> Now you're confusing me... are you saying ptes can be changed from under
> your feet even while holding the pte_lock?

Well, yes, dirty and accessed can be changed from another thread in
userspace while we hold pt lock in the kernel. (But dirty could only
be changed if the pte is writable, and in dirty balancing cases that
should be being prevented.)

But no, that isn't what I was thinking of. pt lock better be enough
to secure against kernel modifications to the pte. I was just thinking
there are (potentially) all those other ptes of the page, and this pte
may be modified the next instant, it wasn't obvious to me that missing
the one is so terrible.

Give me time, please don't let me confuse you, one of us is enough.

Hugh