Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261197AbVAMDSO (ORCPT ); Wed, 12 Jan 2005 22:18:14 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261153AbVAMDSO (ORCPT ); Wed, 12 Jan 2005 22:18:14 -0500 Received: from colin2.muc.de ([193.149.48.15]:42258 "HELO colin2.muc.de") by vger.kernel.org with SMTP id S261197AbVAMDSI (ORCPT ); Wed, 12 Jan 2005 22:18:08 -0500 Date: 13 Jan 2005 04:18:07 +0100 Date: Thu, 13 Jan 2005 04:18:07 +0100 From: Andi Kleen To: Christoph Lameter Cc: Nick Piggin , Andrew Morton , torvalds@osdl.org, hugh@veritas.com, linux-mm@kvack.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, benh@kernel.crashing.org Subject: Re: page table lock patch V15 [0/7]: overview Message-ID: <20050113031807.GA97340@muc.de> References: <41E4BCBE.2010001@yahoo.com.au> <20050112014235.7095dcf4.akpm@osdl.org> <20050112104326.69b99298.akpm@osdl.org> <41E5AFE6.6000509@yahoo.com.au> <20050112153033.6e2e4c6e.akpm@osdl.org> <41E5B7AD.40304@yahoo.com.au> <41E5BC60.3090309@yahoo.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1183 Lines: 35 > There is still an issue as Hugh rightly observed. One cannot rely on a > read of a pte/pud/pmd being atomic if the pte is > word size. This occurs > for all higher levels in handle_mm_fault. Thus we would need to either > acuire the page_table_lock for some architectures or provide primitives > get_pgd, get_pud etc that take the page_table_lock on PAE mode. ARGH. > Alternatively you can use a lazy load, checking for changes. (untested) pte_t read_pte(volatile pte_t *pte) { pte_t n; do { n.pte_low = pte->pte_low; rmb(); n.pte_high = pte->pte_high; rmb(); } while (n.pte_low != pte->pte_low); return pte; } No atomic operations, I bet it's actually faster than the cmpxchg8. There is a small risk for livelock, but not much worse than with an ordinary spinlock. Not that I get it what you want it for exactly - the content of the pte could change any time when you don't hold page_table_lock, right? -Andi - 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/