Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/mm: Enable _PAGE_NUMA for book3s

We steal the _PAGE_COHERENCE bit and use that for indicating NUMA ptes.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Aneesh Kumar K.V and committed by
Benjamin Herrenschmidt
c34a51ce 8937ba48

+72 -1
+65 -1
arch/powerpc/include/asm/pgtable.h
··· 3 3 #ifdef __KERNEL__ 4 4 5 5 #ifndef __ASSEMBLY__ 6 + #include <linux/mmdebug.h> 6 7 #include <asm/processor.h> /* For TASK_SIZE */ 7 8 #include <asm/mmu.h> 8 9 #include <asm/page.h> ··· 34 33 static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 35 34 static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 36 35 static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; } 37 - static inline int pte_present(pte_t pte) { return pte_val(pte) & _PAGE_PRESENT; } 38 36 static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; } 39 37 static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); } 38 + 39 + #ifdef CONFIG_NUMA_BALANCING 40 + 41 + static inline int pte_present(pte_t pte) 42 + { 43 + return pte_val(pte) & (_PAGE_PRESENT | _PAGE_NUMA); 44 + } 45 + 46 + #define pte_numa pte_numa 47 + static inline int pte_numa(pte_t pte) 48 + { 49 + return (pte_val(pte) & 50 + (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA; 51 + } 52 + 53 + #define pte_mknonnuma pte_mknonnuma 54 + static inline pte_t pte_mknonnuma(pte_t pte) 55 + { 56 + pte_val(pte) &= ~_PAGE_NUMA; 57 + pte_val(pte) |= _PAGE_PRESENT | _PAGE_ACCESSED; 58 + return pte; 59 + } 60 + 61 + #define pte_mknuma pte_mknuma 62 + static inline pte_t pte_mknuma(pte_t pte) 63 + { 64 + /* 65 + * We should not set _PAGE_NUMA on non present ptes. Also clear the 66 + * present bit so that hash_page will return 1 and we collect this 67 + * as numa fault. 68 + */ 69 + if (pte_present(pte)) { 70 + pte_val(pte) |= _PAGE_NUMA; 71 + pte_val(pte) &= ~_PAGE_PRESENT; 72 + } else 73 + VM_BUG_ON(1); 74 + return pte; 75 + } 76 + 77 + #define pmd_numa pmd_numa 78 + static inline int pmd_numa(pmd_t pmd) 79 + { 80 + return pte_numa(pmd_pte(pmd)); 81 + } 82 + 83 + #define pmd_mknonnuma pmd_mknonnuma 84 + static inline pmd_t pmd_mknonnuma(pmd_t pmd) 85 + { 86 + return pte_pmd(pte_mknonnuma(pmd_pte(pmd))); 87 + } 88 + 89 + #define pmd_mknuma pmd_mknuma 90 + static inline pmd_t pmd_mknuma(pmd_t pmd) 91 + { 92 + return pte_pmd(pte_mknuma(pmd_pte(pmd))); 93 + } 94 + 95 + # else 96 + 97 + static inline int pte_present(pte_t pte) 98 + { 99 + return pte_val(pte) & _PAGE_PRESENT; 100 + } 101 + #endif /* CONFIG_NUMA_BALANCING */ 40 102 41 103 /* Conversion functions: convert a page and protection to a page entry, 42 104 * and a page entry and page directory to the page they refer to.
+6
arch/powerpc/include/asm/pte-hash64.h
··· 27 27 #define _PAGE_RW 0x0200 /* software: user write access allowed */ 28 28 #define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ 29 29 30 + /* 31 + * Used for tracking numa faults 32 + */ 33 + #define _PAGE_NUMA 0x00000010 /* Gather numa placement stats */ 34 + 35 + 30 36 /* No separate kernel read-only */ 31 37 #define _PAGE_KERNEL_RW (_PAGE_RW | _PAGE_DIRTY) /* user access blocked by key */ 32 38 #define _PAGE_KERNEL_RO _PAGE_KERNEL_RW
+1
arch/powerpc/platforms/Kconfig.cputype
··· 72 72 select PPC_HAVE_PMU_SUPPORT 73 73 select SYS_SUPPORTS_HUGETLBFS 74 74 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if PPC_64K_PAGES 75 + select ARCH_SUPPORTS_NUMA_BALANCING 75 76 76 77 config PPC_BOOK3E_64 77 78 bool "Embedded processors"