Messages in this thread | | | Date | Mon, 24 May 2004 21:00:02 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [PATCH] ppc64: Fix possible race with set_pte on a present PTE |
| |
On Tue, 25 May 2004, Andrea Arcangeli wrote: > > The below patch should fix it, the only problem is that it can screwup > some arch that might use page-faults to keep track of the accessed bit,
Indeed. At least alpha does this - that's where this code came from. SO this will cause infinite page faults on alpha and any other "accessed bit in software" architectures.
Not good.
I suspect we should just make a "ptep_set_bits()" inline function that _atomically_ does "set the dirty/accessed bits". On x86, it would be a simple
asm("lock ; orl %1,%0" :"m" (*ptep) :"r" (entry));
and similarly on most other architectures it should be quite easy to do the equivalent. You can always do it with a simple compare-and-exchange loop, something any SMP-capable architecture should have.
Of course, arguably we can actually optimize this by "knowing" that it is safe to set the dirty bit, so then we don't even need an atomic operation, we just need one atomic write. So we only actually need the atomic op for the accessed bit case, and if we make the write-case be totally separate..
Anybody willing to write up a patch for a few architectures? Is there any architecture out there that would have a problem with this?
Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |