aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2014-10-09 18:26:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-09 22:25:52 -0400
commit6a33979d5bd7521497121c5ae4435d7003115a0f (patch)
treef010f2441b1942f0153b999fa987196e68a30272 /arch/powerpc/include
parented2f240094f900833ac06f533ab8bbcf0a1e8199 (diff)
mm: remove misleading ARCH_USES_NUMA_PROT_NONE
ARCH_USES_NUMA_PROT_NONE was defined for architectures that implemented _PAGE_NUMA using _PROT_NONE. This saved using an additional PTE bit and relied on the fact that PROT_NONE vmas were skipped by the NUMA hinting fault scanner. This was found to be conceptually confusing with a lot of implicit assumptions and it was asked that an alternative be found. Commit c46a7c81 "x86: define _PAGE_NUMA by reusing software bits on the PMD and PTE levels" redefined _PAGE_NUMA on x86 to be one of the swap PTE bits and shrunk the maximum possible swap size but it did not go far enough. There are no architectures that reuse _PROT_NONE as _PROT_NUMA but the relics still exist. This patch removes ARCH_USES_NUMA_PROT_NONE and removes some unnecessary duplication in powerpc vs the generic implementation by defining the types the core NUMA helpers expected to exist from x86 with their ppc64 equivalent. This necessitated that a PTE bit mask be created that identified the bits that distinguish present from NUMA pte entries but it is expected this will only differ between arches based on _PAGE_PROTNONE. The naming for the generic helpers was taken from x86 originally but ppc64 has types that are equivalent for the purposes of the helper so they are mapped instead of duplicating code. Signed-off-by: Mel Gorman <mgorman@suse.de> Cc: Hugh Dickins <hughd@google.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Rik van Riel <riel@redhat.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Cyrill Gorcunov <gorcunov@gmail.com> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.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/pgtable.h57
-rw-r--r--arch/powerpc/include/asm/pte-common.h5
2 files changed, 17 insertions, 45 deletions
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index d98c1ecc3266..f60d4ea8b50c 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -38,10 +38,9 @@ static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK)
38static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); } 38static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); }
39 39
40#ifdef CONFIG_NUMA_BALANCING 40#ifdef CONFIG_NUMA_BALANCING
41
42static inline int pte_present(pte_t pte) 41static inline int pte_present(pte_t pte)
43{ 42{
44 return pte_val(pte) & (_PAGE_PRESENT | _PAGE_NUMA); 43 return pte_val(pte) & _PAGE_NUMA_MASK;
45} 44}
46 45
47#define pte_present_nonuma pte_present_nonuma 46#define pte_present_nonuma pte_present_nonuma
@@ -50,37 +49,6 @@ static inline int pte_present_nonuma(pte_t pte)
50 return pte_val(pte) & (_PAGE_PRESENT); 49 return pte_val(pte) & (_PAGE_PRESENT);
51} 50}
52 51
53#define pte_numa pte_numa
54static inline int pte_numa(pte_t pte)
55{
56 return (pte_val(pte) &
57 (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
58}
59
60#define pte_mknonnuma pte_mknonnuma
61static inline pte_t pte_mknonnuma(pte_t pte)
62{
63 pte_val(pte) &= ~_PAGE_NUMA;
64 pte_val(pte) |= _PAGE_PRESENT | _PAGE_ACCESSED;
65 return pte;
66}
67
68#define pte_mknuma pte_mknuma
69static inline pte_t pte_mknuma(pte_t pte)
70{
71 /*
72 * We should not set _PAGE_NUMA on non present ptes. Also clear the
73 * present bit so that hash_page will return 1 and we collect this
74 * as numa fault.
75 */
76 if (pte_present(pte)) {
77 pte_val(pte) |= _PAGE_NUMA;
78 pte_val(pte) &= ~_PAGE_PRESENT;
79 } else
80 VM_BUG_ON(1);
81 return pte;
82}
83
84#define ptep_set_numa ptep_set_numa 52#define ptep_set_numa ptep_set_numa
85static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr, 53static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr,
86 pte_t *ptep) 54 pte_t *ptep)
@@ -92,12 +60,6 @@ static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr,
92 return; 60 return;
93} 61}
94 62
95#define pmd_numa pmd_numa
96static inline int pmd_numa(pmd_t pmd)
97{
98 return pte_numa(pmd_pte(pmd));
99}
100
101#define pmdp_set_numa pmdp_set_numa 63#define pmdp_set_numa pmdp_set_numa
102static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr, 64static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr,
103 pmd_t *pmdp) 65 pmd_t *pmdp)
@@ -109,16 +71,21 @@ static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr,
109 return; 71 return;
110} 72}
111 73
112#define pmd_mknonnuma pmd_mknonnuma 74/*
113static inline pmd_t pmd_mknonnuma(pmd_t pmd) 75 * Generic NUMA pte helpers expect pteval_t and pmdval_t types to exist
76 * which was inherited from x86. For the purposes of powerpc pte_basic_t and
77 * pmd_t are equivalent
78 */
79#define pteval_t pte_basic_t
80#define pmdval_t pmd_t
81static inline pteval_t ptenuma_flags(pte_t pte)
114{ 82{
115 return pte_pmd(pte_mknonnuma(pmd_pte(pmd))); 83 return pte_val(pte) & _PAGE_NUMA_MASK;
116} 84}
117 85
118#define pmd_mknuma pmd_mknuma 86static inline pmdval_t pmdnuma_flags(pmd_t pmd)
119static inline pmd_t pmd_mknuma(pmd_t pmd)
120{ 87{
121 return pte_pmd(pte_mknuma(pmd_pte(pmd))); 88 return pmd_val(pmd) & _PAGE_NUMA_MASK;
122} 89}
123 90
124# else 91# else
diff --git a/arch/powerpc/include/asm/pte-common.h b/arch/powerpc/include/asm/pte-common.h
index 8d1569c29042..e040c3595129 100644
--- a/arch/powerpc/include/asm/pte-common.h
+++ b/arch/powerpc/include/asm/pte-common.h
@@ -98,6 +98,11 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void);
98 _PAGE_USER | _PAGE_ACCESSED | \ 98 _PAGE_USER | _PAGE_ACCESSED | \
99 _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | _PAGE_EXEC) 99 _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | _PAGE_EXEC)
100 100
101#ifdef CONFIG_NUMA_BALANCING
102/* Mask of bits that distinguish present and numa ptes */
103#define _PAGE_NUMA_MASK (_PAGE_NUMA|_PAGE_PRESENT)
104#endif
105
101/* 106/*
102 * We define 2 sets of base prot bits, one for basic pages (ie, 107 * We define 2 sets of base prot bits, one for basic pages (ie,
103 * cacheable kernel and user pages) and one for non cacheable 108 * cacheable kernel and user pages) and one for non cacheable