powerpc: implement pte_special for 64K pages
Subsystems (2)
PATCH 1/1 powerpc: implement pte_special for 64K pages
This can be folded into powerpc-implement-pte_special.patch
--
Ben has now freed up a pte bit on 64k pages. Use it for special pte bit.
---
include/asm-powerpc/pgtable-64k.h +2 -1
@@ -70,11 +70,12 @@#define PGDIR_MASK (~(PGDIR_SIZE-1))/* Additional PTE bits (don't change without checking asm in hash_low.S) */ +#define __HAVE_ARCH_PTE_SPECIAL +#define _PAGE_SPECIAL 0x00000400/* software: special page */ #define _PAGE_HPTE_SUB 0x0ffff000/* combo only: sub pages HPTE bits */ #define _PAGE_HPTE_SUB0 0x08000000/* combo only: first sub page */ #define _PAGE_COMBO 0x10000000/* this is a combo 4k page */ #define _PAGE_4K_PFN 0x20000000/* PFN is for a single 4k page */ -#define _PAGE_SPECIAL 0x0/* don't have enough room for this yet */ /* For 64K page, we don't have a separate _PAGE_HASHPTE bit. Instead, * we set that to be the whole sub-bits mask. The C code will only
PATCH 1/1 powerpc: lockless get_user_pages
Together with the previous patch, I've tested this on mmotm, including with 64K base pages. However I only have a machine with a single possible hugepage size, so testing a real multi size system would be nice.
Thanks to Dave for reworking for multiple hugepage sizes (Dave, I had to make a small change to the slice shift calculation here).
--
powerpc: lockless get_user_pages_fast
Implement lockless get_user_pages_fast for powerpc. Page table existence is guaranteed with RCU, and speculative page references are used to take a reference to the pages without having a prior existence guarantee on them.
--- arch/powerpc/Kconfig | 3 arch/powerpc/mm/Makefile | 2 arch/powerpc/mm/gup.c | 245 ++++++++++++++++++++++++++++++++++++ include/asm-powerpc/pgtable-ppc64.h | 2 include/linux/pagemap.h | 23 +++ 6 files changed, 275 insertions(+), 2 deletions(-)
include/asm-powerpc/pgtable-ppc64.h +2 -0
@@ -461,6 +461,8 @@return pt; } +pte_t *huge_pte_offset (struct mm_struct *mm,unsigned long address); +#endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */
include/linux/pagemap.h +23 -0
@@ -171,6 +171,29 @@return 1 ; } +/* +* Same as above, but add instead of inc (could just be merged) +*/ +static inline int page_cache_add_speculative (struct page *page,int count) +{ +VM_BUG_ON (in_interrupt ()); + +#if !defined(CONFIG_SMP ) && defined(CONFIG_CLASSIC_RCU ) +# ifdef CONFIG_PREEMPT +VM_BUG_ON (!in_atomic ()); +# endif +VM_BUG_ON (page_count (page) ==0 ); +atomic_add (count, &page->_count); + +#else +if (unlikely (!atomic_add_unless (&page->_count, count,0 ))) +return 0 ; +#endif +VM_BUG_ON (PageCompound (page) && page !=compound_head (page)); + +return 1 ; +} +static inline int page_freeze_refs (struct page *page,int count) {return likely (atomic_cmpxchg (&page->_count, count,0 ) == count);
arch/powerpc/mm/Makefile +1 -1
@@ -6,7 +6,7 @@ EXTRA_CFLAGS += -mno-minimal-toc endif -obj-y := fault.o mem.o \ +obj-y := fault.o mem.o gup.o \ init_$(CONFIG_WORD_SIZE).o \ pgtable_$(CONFIG_WORD_SIZE).o \ mmu_context_$(CONFIG_WORD_SIZE).o
arch/powerpc/mm/gup.c new file +258 -0
258 lines not on this page · raw message
arch/powerpc/Kconfig +3 -0
@@ -42,6 +42,9 @@ bool default y +config HAVE_GET_USER_PAGES_FAST + def_bool PPC64 + config HAVE_SETUP_PER_CPU_AREA def_bool PPC64
Quoted 7 lines · Nick Piggin
This can be folded into powerpc-implement-pte_special.patch
--
Ben has now freed up a pte bit on 64k pages. Use it for special pte bit.Signed-off-by Nick Piggin <[email protected]>---
Ack.
Andrew, will you merge this or do you want me to ?
Cheers,
Ben.
Quoted 18 lines
Index:
linux-2.6/include/asm-powerpc/pgtable-64k.h
===================================================================include/asm-powerpc/pgtable-64k.h +2
-1@@ -70,11 +70,12 @@#define PGDIR_MASK (~(PGDIR_SIZE-1))/* Additional PTE bits (don't change without checking asm in hash_low.S) */ +#define __HAVE_ARCH_PTE_SPECIAL +#define _PAGE_SPECIAL 0x00000400/* software: special page */ #define _PAGE_HPTE_SUB 0x0ffff000/* combo only: sub pages HPTE bits */ #define _PAGE_HPTE_SUB0 0x08000000/* combo only: first sub page */ #define _PAGE_COMBO 0x10000000/* this is a combo 4k page */ #define _PAGE_4K_PFN 0x20000000/* PFN is for a single 4k page */ -#define _PAGE_SPECIAL 0x0/* don't have enough room for this yet */ /* For 64K page, we don't have a separate _PAGE_HASHPTE bit. Instead, * we set that to be the whole sub-bits mask. The C code will only
Quoted 6 lines · On Mon, 21 Jul 2008 10:57:55 +1000 Benjamin Herrenschmidt…
Quoted 5 lines · Nick Piggin
This can be folded into powerpc-implement-pte_special.patch
--
Ben has now freed up a pte bit on 64k pages. Use it for special pte bit.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Nick Piggin <[email protected]>---
Ack.
Andrew, will you merge this or do you want me to ?
I can do so.
Quoted 8 lines · Andrew Morton
Quoted 6 lines · On Mon, 21 Jul 2008 10:57:55 +1000 Benjamin Herrenschmidt…
Quoted 5 lines · Nick Piggin
This can be folded into powerpc-implement-pte_special.patch
--
Ben has now freed up a pte bit on 64k pages. Use it for special pte bit.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Signed-off-by Nick Piggin <[email protected]>---
Ack.
Andrew, will you merge this or do you want me to ?
I can do so.
Thanks.
Cheers,
Ben.