diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2013-11-18 04:28:13 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-12-08 19:40:30 -0500 |
commit | c34a51ce49b40b9667cd7f5cc2e40475af8b4c3d (patch) | |
tree | 1da860c5262597084358807f84a5003dc022a472 | |
parent | 8937ba48dcf62b5cdf7abb93652914af16756f50 (diff) |
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>
-rw-r--r-- | arch/powerpc/include/asm/pgtable.h | 66 | ||||
-rw-r--r-- | arch/powerpc/include/asm/pte-hash64.h | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/Kconfig.cputype | 1 |
3 files changed, 72 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 7d6eacf249cf..b999ca318985 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | #ifndef __ASSEMBLY__ | 5 | #ifndef __ASSEMBLY__ |
6 | #include <linux/mmdebug.h> | ||
6 | #include <asm/processor.h> /* For TASK_SIZE */ | 7 | #include <asm/processor.h> /* For TASK_SIZE */ |
7 | #include <asm/mmu.h> | 8 | #include <asm/mmu.h> |
8 | #include <asm/page.h> | 9 | #include <asm/page.h> |
@@ -33,10 +34,73 @@ static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | |||
33 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 34 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
34 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 35 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
35 | static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; } | 36 | static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; } |
36 | static inline int pte_present(pte_t pte) { return pte_val(pte) & _PAGE_PRESENT; } | ||
37 | static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; } | 37 | static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; } |
38 | static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); } | 38 | static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); } |
39 | 39 | ||
40 | #ifdef CONFIG_NUMA_BALANCING | ||
41 | |||
42 | static inline int pte_present(pte_t pte) | ||
43 | { | ||
44 | return pte_val(pte) & (_PAGE_PRESENT | _PAGE_NUMA); | ||
45 | } | ||
46 | |||
47 | #define pte_numa pte_numa | ||
48 | static inline int pte_numa(pte_t pte) | ||
49 | { | ||
50 | return (pte_val(pte) & | ||
51 | (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA; | ||
52 | } | ||
53 | |||
54 | #define pte_mknonnuma pte_mknonnuma | ||
55 | static inline pte_t pte_mknonnuma(pte_t pte) | ||
56 | { | ||
57 | pte_val(pte) &= ~_PAGE_NUMA; | ||
58 | pte_val(pte) |= _PAGE_PRESENT | _PAGE_ACCESSED; | ||
59 | return pte; | ||
60 | } | ||
61 | |||
62 | #define pte_mknuma pte_mknuma | ||
63 | static inline pte_t pte_mknuma(pte_t pte) | ||
64 | { | ||
65 | /* | ||
66 | * We should not set _PAGE_NUMA on non present ptes. Also clear the | ||
67 | * present bit so that hash_page will return 1 and we collect this | ||
68 | * as numa fault. | ||
69 | */ | ||
70 | if (pte_present(pte)) { | ||
71 | pte_val(pte) |= _PAGE_NUMA; | ||
72 | pte_val(pte) &= ~_PAGE_PRESENT; | ||
73 | } else | ||
74 | VM_BUG_ON(1); | ||
75 | return pte; | ||
76 | } | ||
77 | |||
78 | #define pmd_numa pmd_numa | ||
79 | static inline int pmd_numa(pmd_t pmd) | ||
80 | { | ||
81 | return pte_numa(pmd_pte(pmd)); | ||
82 | } | ||
83 | |||
84 | #define pmd_mknonnuma pmd_mknonnuma | ||
85 | static inline pmd_t pmd_mknonnuma(pmd_t pmd) | ||
86 | { | ||
87 | return pte_pmd(pte_mknonnuma(pmd_pte(pmd))); | ||
88 | } | ||
89 | |||
90 | #define pmd_mknuma pmd_mknuma | ||
91 | static inline pmd_t pmd_mknuma(pmd_t pmd) | ||
92 | { | ||
93 | return pte_pmd(pte_mknuma(pmd_pte(pmd))); | ||
94 | } | ||
95 | |||
96 | # else | ||
97 | |||
98 | static inline int pte_present(pte_t pte) | ||
99 | { | ||
100 | return pte_val(pte) & _PAGE_PRESENT; | ||
101 | } | ||
102 | #endif /* CONFIG_NUMA_BALANCING */ | ||
103 | |||
40 | /* Conversion functions: convert a page and protection to a page entry, | 104 | /* Conversion functions: convert a page and protection to a page entry, |
41 | * and a page entry and page directory to the page they refer to. | 105 | * and a page entry and page directory to the page they refer to. |
42 | * | 106 | * |
diff --git a/arch/powerpc/include/asm/pte-hash64.h b/arch/powerpc/include/asm/pte-hash64.h index 55aea0caf95e..2505d8eab15c 100644 --- a/arch/powerpc/include/asm/pte-hash64.h +++ b/arch/powerpc/include/asm/pte-hash64.h | |||
@@ -27,6 +27,12 @@ | |||
27 | #define _PAGE_RW 0x0200 /* software: user write access allowed */ | 27 | #define _PAGE_RW 0x0200 /* software: user write access allowed */ |
28 | #define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ | 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 | /* No separate kernel read-only */ | 36 | /* No separate kernel read-only */ |
31 | #define _PAGE_KERNEL_RW (_PAGE_RW | _PAGE_DIRTY) /* user access blocked by key */ | 37 | #define _PAGE_KERNEL_RW (_PAGE_RW | _PAGE_DIRTY) /* user access blocked by key */ |
32 | #define _PAGE_KERNEL_RO _PAGE_KERNEL_RW | 38 | #define _PAGE_KERNEL_RO _PAGE_KERNEL_RW |
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index bca2465a9c34..434fda39bf8b 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype | |||
@@ -72,6 +72,7 @@ config PPC_BOOK3S_64 | |||
72 | select PPC_HAVE_PMU_SUPPORT | 72 | select PPC_HAVE_PMU_SUPPORT |
73 | select SYS_SUPPORTS_HUGETLBFS | 73 | select SYS_SUPPORTS_HUGETLBFS |
74 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE if PPC_64K_PAGES | 74 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE if PPC_64K_PAGES |
75 | select ARCH_SUPPORTS_NUMA_BALANCING | ||
75 | 76 | ||
76 | config PPC_BOOK3E_64 | 77 | config PPC_BOOK3E_64 |
77 | bool "Embedded processors" | 78 | bool "Embedded processors" |