Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S268383AbUJOTLn (ORCPT ); Fri, 15 Oct 2004 15:11:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S268382AbUJOTKU (ORCPT ); Fri, 15 Oct 2004 15:10:20 -0400 Received: from omx1-ext.sgi.com ([192.48.179.11]:20940 "EHLO omx1.americas.sgi.com") by vger.kernel.org with ESMTP id S268334AbUJOTH5 (ORCPT ); Fri, 15 Oct 2004 15:07:57 -0400 Date: Fri, 15 Oct 2004 12:07:31 -0700 (PDT) From: Christoph Lameter X-X-Sender: clameter@schroedinger.engr.sgi.com To: akpm@osdl.org cc: linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org Subject: page fault scalability patch V10: [6/7] x86_64 atomic pte operations In-Reply-To: Message-ID: References: <20040920205752.GH4242@wotan.suse.de> <200409211841.25507.vda@port.imtp.ilyichevsk.odessa.ua> <20040921154542.GB12132@wotan.suse.de> <41527885.8020402@myrealbox.com> <20040923090345.GA6146@wotan.suse.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2319 Lines: 57 Changelog * Provide atomic pte operations for x86_64 Signed-off-by: Christoph Lameter Index: linux-2.6.9-rc4/include/asm-x86_64/pgalloc.h =================================================================== --- linux-2.6.9-rc4.orig/include/asm-x86_64/pgalloc.h 2004-10-10 19:57:59.000000000 -0700 +++ linux-2.6.9-rc4/include/asm-x86_64/pgalloc.h 2004-10-15 11:20:36.000000000 -0700 @@ -7,16 +7,26 @@ #include #include +#define PMD_NONE 0 +#define PGD_NONE 0 + #define pmd_populate_kernel(mm, pmd, pte) \ set_pmd(pmd, __pmd(_PAGE_TABLE | __pa(pte))) #define pgd_populate(mm, pgd, pmd) \ set_pgd(pgd, __pgd(_PAGE_TABLE | __pa(pmd))) +#define pgd_test_and_populate(mm, pgd, pmd) \ + (cmpxchg((int *)pgd, PGD_NONE, _PAGE_TABLE | __pa(pmd)) == PGD_NONE) static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte) { set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT))); } +static inline int pmd_test_and_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte) +{ + return cmpxchg((int *)pmd, PMD_NONE, _PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT)) == PMD_NONE; +} + extern __inline__ pmd_t *get_pmd(void) { return (pmd_t *)get_zeroed_page(GFP_KERNEL); Index: linux-2.6.9-rc4/include/asm-x86_64/pgtable.h =================================================================== --- linux-2.6.9-rc4.orig/include/asm-x86_64/pgtable.h 2004-10-10 19:58:23.000000000 -0700 +++ linux-2.6.9-rc4/include/asm-x86_64/pgtable.h 2004-10-15 11:21:27.000000000 -0700 @@ -436,6 +436,11 @@ #define kc_offset_to_vaddr(o) \ (((o) & (1UL << (__VIRTUAL_MASK_SHIFT-1))) ? ((o) | (~__VIRTUAL_MASK)) : (o)) + +#define ptep_xchg(addr,xp,newval) __pte(xchg(&(xp)->pte, pte_val(newval))) +#define ptep_cmpxchg(mm,addr,xp,oldval,newval) (cmpxchg(&(xp)->pte, pte_val(oldval), pte_val(newval)) == pte_val(oldval)) +#define __HAVE_ARCH_ATOMIC_TABLE_OPS + #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY #define __HAVE_ARCH_PTEP_GET_AND_CLEAR - 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/