diff options
| author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-05-24 20:12:00 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 11:39:16 -0400 |
| commit | 267239116987d64850ad2037d8e0f3071dc3b5ce (patch) | |
| tree | 142595897f7fc7bb673b791891dcc2fab31f6e91 /arch/powerpc/include | |
| parent | 1c395176962176660bb108f90e97e1686cfe0d85 (diff) | |
mm, powerpc: move the RCU page-table freeing into generic code
In case other architectures require RCU freed page-tables to implement
gup_fast() and software filled hashes and similar things, provide the
means to do so by moving the logic into generic code.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Requested-by: David Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Tony Luck <tony.luck@intel.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc/include')
| -rw-r--r-- | arch/powerpc/include/asm/pgalloc.h | 21 | ||||
| -rw-r--r-- | arch/powerpc/include/asm/tlb.h | 10 |
2 files changed, 18 insertions, 13 deletions
diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h index df1b4cbb2e7..bf301ac62f3 100644 --- a/arch/powerpc/include/asm/pgalloc.h +++ b/arch/powerpc/include/asm/pgalloc.h | |||
| @@ -31,14 +31,29 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage) | |||
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | #ifdef CONFIG_SMP | 33 | #ifdef CONFIG_SMP |
| 34 | extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift); | 34 | struct mmu_gather; |
| 35 | extern void pte_free_finish(struct mmu_gather *tlb); | 35 | extern void tlb_remove_table(struct mmu_gather *, void *); |
| 36 | |||
| 37 | static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift) | ||
| 38 | { | ||
| 39 | unsigned long pgf = (unsigned long)table; | ||
| 40 | BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE); | ||
| 41 | pgf |= shift; | ||
| 42 | tlb_remove_table(tlb, (void *)pgf); | ||
| 43 | } | ||
| 44 | |||
| 45 | static inline void __tlb_remove_table(void *_table) | ||
| 46 | { | ||
| 47 | void *table = (void *)((unsigned long)_table & ~MAX_PGTABLE_INDEX_SIZE); | ||
| 48 | unsigned shift = (unsigned long)_table & MAX_PGTABLE_INDEX_SIZE; | ||
| 49 | |||
| 50 | pgtable_free(table, shift); | ||
| 51 | } | ||
| 36 | #else /* CONFIG_SMP */ | 52 | #else /* CONFIG_SMP */ |
| 37 | static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift) | 53 | static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift) |
| 38 | { | 54 | { |
| 39 | pgtable_free(table, shift); | 55 | pgtable_free(table, shift); |
| 40 | } | 56 | } |
| 41 | static inline void pte_free_finish(struct mmu_gather *tlb) { } | ||
| 42 | #endif /* !CONFIG_SMP */ | 57 | #endif /* !CONFIG_SMP */ |
| 43 | 58 | ||
| 44 | static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage, | 59 | static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage, |
diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/tlb.h index 8f0ed7adcd1..e2b428b0f7b 100644 --- a/arch/powerpc/include/asm/tlb.h +++ b/arch/powerpc/include/asm/tlb.h | |||
| @@ -28,16 +28,6 @@ | |||
| 28 | #define tlb_start_vma(tlb, vma) do { } while (0) | 28 | #define tlb_start_vma(tlb, vma) do { } while (0) |
| 29 | #define tlb_end_vma(tlb, vma) do { } while (0) | 29 | #define tlb_end_vma(tlb, vma) do { } while (0) |
| 30 | 30 | ||
| 31 | #define HAVE_ARCH_MMU_GATHER 1 | ||
| 32 | |||
| 33 | struct pte_freelist_batch; | ||
| 34 | |||
| 35 | struct arch_mmu_gather { | ||
| 36 | struct pte_freelist_batch *batch; | ||
| 37 | }; | ||
| 38 | |||
| 39 | #define ARCH_MMU_GATHER_INIT (struct arch_mmu_gather){ .batch = NULL, } | ||
| 40 | |||
| 41 | extern void tlb_flush(struct mmu_gather *tlb); | 31 | extern void tlb_flush(struct mmu_gather *tlb); |
| 42 | 32 | ||
| 43 | /* Get the generic bits... */ | 33 | /* Get the generic bits... */ |
