From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 24 May 2004 21:44:08 -0700 (PDT) From: Linus Torvalds Subject: Re: [PATCH] ppc64: Fix possible race with set_pte on a present PTE In-Reply-To: Message-ID: References: <1085369393.15315.28.camel@gaston> <1085371988.15281.38.camel@gaston> <1085373839.14969.42.camel@gaston> <20040525034326.GT29378@dualathlon.random> <20040525042054.GU29378@dualathlon.random> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org Return-Path: To: Andrea Arcangeli Cc: Benjamin Herrenschmidt , Andrew Morton , Linux Kernel list , Ingo Molnar , Ben LaHaise , linux-mm@kvack.org, Architectures Group List-ID: On Mon, 24 May 2004, Linus Torvalds wrote: > > We do the accessed bit by clearing the "user readable" thing (or > something. I forget the exact details, and I'm too lazy to check it out). Yup. Lookie here: #define __ACCESS_BITS (_PAGE_ACCESSED | _PAGE_KRE | _PAGE_URE) extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~(__ACCESS_BITS); return pte; } Notice how an "old" pte won't be readable. Then, when we take the page fault, we'll do extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; return pte; } and now the pte is readable again. In other words, we absolutely _have_ to do the "pte_mkyoung()" part in the page fault, or an "old" pte will never become readable again (unless it's accessed with a write rather than a read, which will then happen to make it young again). I'm not quite senile yet. Linus -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: aart@kvack.org