From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: [PATCH 21/28] sparc64: Use RCU page table freeing. Date: Mon, 07 Jun 2010 13:07:15 +0200 Message-ID: <20100607111408.320302531@chello.nl> References: <20100607110654.606530953@chello.nl> Return-path: Received: from [18.85.46.34] ([18.85.46.34]:37753 "EHLO bombadil.infradead.org" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S932212Ab0FGLUi (ORCPT ); Mon, 7 Jun 2010 07:20:38 -0400 Content-Disposition: inline; filename=davem-sparc64-Use_RCU_page_table_freeing.patch Sender: linux-arch-owner@vger.kernel.org List-ID: To: Andrea Arcangeli , Avi Kivity , Thomas Gleixner , Rik van Riel , Ingo Molnar , akpm@linux-fou Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Benjamin Herrenschmidt , David Miller , Hugh Dickins , Mel Gorman , Nick Piggin , Peter Zijlstra , "Paul E. McKenney" From: David S. Miller Signed-off-by: David S. Miller Signed-off-by: Peter Zijlstra LKML-Reference: <20100408.180008.180206930.davem@davemloft.net> --- arch/sparc/include/asm/pgalloc_64.h | 49 ++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) Index: linux-2.6/arch/sparc/include/asm/pgalloc_64.h =================================================================== --- linux-2.6.orig/arch/sparc/include/asm/pgalloc_64.h +++ linux-2.6/arch/sparc/include/asm/pgalloc_64.h @@ -76,7 +76,52 @@ static inline void pte_free(struct mm_st #define check_pgt_cache() do { } while (0) -#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte) -#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd) +static inline void pgtable_free(void *table, bool is_page) +{ + if (is_page) + free_page((unsigned long)table); + else + kmem_cache_free(pgtable_cache, table); +} + +#ifdef CONFIG_SMP +#define HAVE_ARCH_RCU_TABLE_FREE + +struct mmu_gather; +extern void tlb_remove_table(struct mmu_gather *, void *); + +static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page) +{ + unsigned long pgf = (unsigned long)table; + if (is_page) + pgf |= 0x1UL; + tlb_remove_table(tlb, (void *)pgf); +} + +static inline void __tlb_remove_table(void *_table) +{ + void *table = (void *)((unsigned long)_table & ~0x1UL); + bool is_page = false; + + if ((unsigned long)_table & 0x1UL) + is_page = true; + pgtable_free(table, is_page); +} +#else /* CONFIG_SMP */ +static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page) +{ + pgtable_free(table, is_page); +} +#endif /* !CONFIG_SMP */ + +static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage, + unsigned long address) +{ + pgtable_page_dtor(ptepage); + pgtable_free_tlb(tlb, page_address(ptepage), true); +} + +#define __pmd_free_tlb(tlb, pmd, addr) \ + pgtable_free_tlb(tlb, pmd, false) #endif /* _SPARC64_PGALLOC_H */ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [18.85.46.34] ([18.85.46.34]:37753 "EHLO bombadil.infradead.org" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S932212Ab0FGLUi (ORCPT ); Mon, 7 Jun 2010 07:20:38 -0400 Message-ID: <20100607111408.320302531@chello.nl> Date: Mon, 07 Jun 2010 13:07:15 +0200 From: Peter Zijlstra Subject: [PATCH 21/28] sparc64: Use RCU page table freeing. References: <20100607110654.606530953@chello.nl> Content-Disposition: inline; filename=davem-sparc64-Use_RCU_page_table_freeing.patch Sender: linux-arch-owner@vger.kernel.org List-ID: To: Andrea Arcangeli , Avi Kivity , Thomas Gleixner , Rik van Riel , Ingo Molnar , akpm@linux-foundation.org, Linus Torvalds Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Benjamin Herrenschmidt , David Miller , Hugh Dickins , Mel Gorman , Nick Piggin , Peter Zijlstra , "Paul E. McKenney" Message-ID: <20100607110715.Y6aFD9pQtUauajzC1yWJMP0Du7k-4N1h7hkBJWdWGyY@z> From: David S. Miller Signed-off-by: David S. Miller Signed-off-by: Peter Zijlstra LKML-Reference: <20100408.180008.180206930.davem@davemloft.net> --- arch/sparc/include/asm/pgalloc_64.h | 49 ++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) Index: linux-2.6/arch/sparc/include/asm/pgalloc_64.h =================================================================== --- linux-2.6.orig/arch/sparc/include/asm/pgalloc_64.h +++ linux-2.6/arch/sparc/include/asm/pgalloc_64.h @@ -76,7 +76,52 @@ static inline void pte_free(struct mm_st #define check_pgt_cache() do { } while (0) -#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte) -#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd) +static inline void pgtable_free(void *table, bool is_page) +{ + if (is_page) + free_page((unsigned long)table); + else + kmem_cache_free(pgtable_cache, table); +} + +#ifdef CONFIG_SMP +#define HAVE_ARCH_RCU_TABLE_FREE + +struct mmu_gather; +extern void tlb_remove_table(struct mmu_gather *, void *); + +static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page) +{ + unsigned long pgf = (unsigned long)table; + if (is_page) + pgf |= 0x1UL; + tlb_remove_table(tlb, (void *)pgf); +} + +static inline void __tlb_remove_table(void *_table) +{ + void *table = (void *)((unsigned long)_table & ~0x1UL); + bool is_page = false; + + if ((unsigned long)_table & 0x1UL) + is_page = true; + pgtable_free(table, is_page); +} +#else /* CONFIG_SMP */ +static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page) +{ + pgtable_free(table, is_page); +} +#endif /* !CONFIG_SMP */ + +static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage, + unsigned long address) +{ + pgtable_page_dtor(ptepage); + pgtable_free_tlb(tlb, page_address(ptepage), true); +} + +#define __pmd_free_tlb(tlb, pmd, addr) \ + pgtable_free_tlb(tlb, pmd, false) #endif /* _SPARC64_PGALLOC_H */