From 3a6c5be223782296d23e5f43c28cf0777bb7a4b5 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 25 Jul 2011 17:12:21 -0700 Subject: [PATCH] --- yaml --- r: 258950 b: refs/heads/master c: 4a0100f7546fb642e0e04a38fa7ca198cd016b47 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/sparc/Kconfig | 1 + trunk/arch/sparc/include/asm/pgalloc_64.h | 48 ++++++++++++++++++++++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 316e5fb62822..e83024e868ea 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4dedbf8dc1c825f2e4aa2d2624058533b5d76f85 +refs/heads/master: 4a0100f7546fb642e0e04a38fa7ca198cd016b47 diff --git a/trunk/arch/sparc/Kconfig b/trunk/arch/sparc/Kconfig index af64348775e2..1074dddcb104 100644 --- a/trunk/arch/sparc/Kconfig +++ b/trunk/arch/sparc/Kconfig @@ -41,6 +41,7 @@ config SPARC64 select HAVE_FUNCTION_TRACE_MCOUNT_TEST select HAVE_KRETPROBES select HAVE_KPROBES + select HAVE_RCU_TABLE_FREE if SMP select HAVE_MEMBLOCK select HAVE_SYSCALL_WRAPPERS select HAVE_DYNAMIC_FTRACE diff --git a/trunk/arch/sparc/include/asm/pgalloc_64.h b/trunk/arch/sparc/include/asm/pgalloc_64.h index cb4867de06a2..40b2d7a7023d 100644 --- a/trunk/arch/sparc/include/asm/pgalloc_64.h +++ b/trunk/arch/sparc/include/asm/pgalloc_64.h @@ -76,7 +76,51 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage) #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 + +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 */