diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2016-01-15 19:53:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-15 20:56:32 -0500 |
commit | b27873702b0604dc4000811e6aa43e18457013de (patch) | |
tree | 5180d11c70145dbee54633e367882d15e08f3f49 | |
parent | 0ebd74461559320364a8228efd1c12d91dd68db3 (diff) |
mips, thp: remove infrastructure for handling splitting PMDs
With new refcounting we don't need to mark PMDs splitting. Let's drop
code to handle this.
pmdp_splitting_flush() is not needed too: on splitting PMD we will do
pmdp_clear_flush() + set_pte_at(). pmdp_clear_flush() will do IPI as
needed for fast_gup.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Steve Capper <steve.capper@linaro.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/mips/include/asm/pgtable-bits.h | 10 | ||||
-rw-r--r-- | arch/mips/include/asm/pgtable.h | 18 | ||||
-rw-r--r-- | arch/mips/mm/gup.c | 13 | ||||
-rw-r--r-- | arch/mips/mm/pgtable-64.c | 14 | ||||
-rw-r--r-- | arch/mips/mm/tlbex.c | 1 |
5 files changed, 5 insertions, 51 deletions
diff --git a/arch/mips/include/asm/pgtable-bits.h b/arch/mips/include/asm/pgtable-bits.h index ff7ad91c85db..97b313882678 100644 --- a/arch/mips/include/asm/pgtable-bits.h +++ b/arch/mips/include/asm/pgtable-bits.h | |||
@@ -131,14 +131,12 @@ | |||
131 | /* Huge TLB page */ | 131 | /* Huge TLB page */ |
132 | #define _PAGE_HUGE_SHIFT (_PAGE_MODIFIED_SHIFT + 1) | 132 | #define _PAGE_HUGE_SHIFT (_PAGE_MODIFIED_SHIFT + 1) |
133 | #define _PAGE_HUGE (1 << _PAGE_HUGE_SHIFT) | 133 | #define _PAGE_HUGE (1 << _PAGE_HUGE_SHIFT) |
134 | #define _PAGE_SPLITTING_SHIFT (_PAGE_HUGE_SHIFT + 1) | ||
135 | #define _PAGE_SPLITTING (1 << _PAGE_SPLITTING_SHIFT) | ||
136 | #endif /* CONFIG_64BIT && CONFIG_MIPS_HUGE_TLB_SUPPORT */ | 134 | #endif /* CONFIG_64BIT && CONFIG_MIPS_HUGE_TLB_SUPPORT */ |
137 | 135 | ||
138 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 136 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) |
139 | /* XI - page cannot be executed */ | 137 | /* XI - page cannot be executed */ |
140 | #ifdef _PAGE_SPLITTING_SHIFT | 138 | #ifdef _PAGE_HUGE_SHIFT |
141 | #define _PAGE_NO_EXEC_SHIFT (_PAGE_SPLITTING_SHIFT + 1) | 139 | #define _PAGE_NO_EXEC_SHIFT (_PAGE_HUGE_SHIFT + 1) |
142 | #else | 140 | #else |
143 | #define _PAGE_NO_EXEC_SHIFT (_PAGE_MODIFIED_SHIFT + 1) | 141 | #define _PAGE_NO_EXEC_SHIFT (_PAGE_MODIFIED_SHIFT + 1) |
144 | #endif | 142 | #endif |
@@ -153,8 +151,8 @@ | |||
153 | 151 | ||
154 | #if defined(_PAGE_NO_READ_SHIFT) | 152 | #if defined(_PAGE_NO_READ_SHIFT) |
155 | #define _PAGE_GLOBAL_SHIFT (_PAGE_NO_READ_SHIFT + 1) | 153 | #define _PAGE_GLOBAL_SHIFT (_PAGE_NO_READ_SHIFT + 1) |
156 | #elif defined(_PAGE_SPLITTING_SHIFT) | 154 | #elif defined(_PAGE_HUGE_SHIFT) |
157 | #define _PAGE_GLOBAL_SHIFT (_PAGE_SPLITTING_SHIFT + 1) | 155 | #define _PAGE_GLOBAL_SHIFT (_PAGE_HUGE_SHIFT + 1) |
158 | #else | 156 | #else |
159 | #define _PAGE_GLOBAL_SHIFT (_PAGE_MODIFIED_SHIFT + 1) | 157 | #define _PAGE_GLOBAL_SHIFT (_PAGE_MODIFIED_SHIFT + 1) |
160 | #endif | 158 | #endif |
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 8957f15e21ec..6995b4a02e23 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h | |||
@@ -482,27 +482,9 @@ static inline pmd_t pmd_mkhuge(pmd_t pmd) | |||
482 | return pmd; | 482 | return pmd; |
483 | } | 483 | } |
484 | 484 | ||
485 | static inline int pmd_trans_splitting(pmd_t pmd) | ||
486 | { | ||
487 | return !!(pmd_val(pmd) & _PAGE_SPLITTING); | ||
488 | } | ||
489 | |||
490 | static inline pmd_t pmd_mksplitting(pmd_t pmd) | ||
491 | { | ||
492 | pmd_val(pmd) |= _PAGE_SPLITTING; | ||
493 | |||
494 | return pmd; | ||
495 | } | ||
496 | |||
497 | extern void set_pmd_at(struct mm_struct *mm, unsigned long addr, | 485 | extern void set_pmd_at(struct mm_struct *mm, unsigned long addr, |
498 | pmd_t *pmdp, pmd_t pmd); | 486 | pmd_t *pmdp, pmd_t pmd); |
499 | 487 | ||
500 | #define __HAVE_ARCH_PMDP_SPLITTING_FLUSH | ||
501 | /* Extern to avoid header file madness */ | ||
502 | extern void pmdp_splitting_flush(struct vm_area_struct *vma, | ||
503 | unsigned long address, | ||
504 | pmd_t *pmdp); | ||
505 | |||
506 | #define __HAVE_ARCH_PMD_WRITE | 488 | #define __HAVE_ARCH_PMD_WRITE |
507 | static inline int pmd_write(pmd_t pmd) | 489 | static inline int pmd_write(pmd_t pmd) |
508 | { | 490 | { |
diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c index 36a35115dc2e..1afd87c999b0 100644 --- a/arch/mips/mm/gup.c +++ b/arch/mips/mm/gup.c | |||
@@ -107,18 +107,7 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end, | |||
107 | pmd_t pmd = *pmdp; | 107 | pmd_t pmd = *pmdp; |
108 | 108 | ||
109 | next = pmd_addr_end(addr, end); | 109 | next = pmd_addr_end(addr, end); |
110 | /* | 110 | if (pmd_none(pmd)) |
111 | * The pmd_trans_splitting() check below explains why | ||
112 | * pmdp_splitting_flush has to flush the tlb, to stop | ||
113 | * this gup-fast code from running while we set the | ||
114 | * splitting bit in the pmd. Returning zero will take | ||
115 | * the slow path that will call wait_split_huge_page() | ||
116 | * if the pmd is still in splitting state. gup-fast | ||
117 | * can't because it has irq disabled and | ||
118 | * wait_split_huge_page() would never return as the | ||
119 | * tlb flush IPI wouldn't run. | ||
120 | */ | ||
121 | if (pmd_none(pmd) || pmd_trans_splitting(pmd)) | ||
122 | return 0; | 111 | return 0; |
123 | if (unlikely(pmd_huge(pmd))) { | 112 | if (unlikely(pmd_huge(pmd))) { |
124 | if (!gup_huge_pmd(pmd, addr, next, write, pages,nr)) | 113 | if (!gup_huge_pmd(pmd, addr, next, write, pages,nr)) |
diff --git a/arch/mips/mm/pgtable-64.c b/arch/mips/mm/pgtable-64.c index e8adc0069d66..ce4473e7c0d2 100644 --- a/arch/mips/mm/pgtable-64.c +++ b/arch/mips/mm/pgtable-64.c | |||
@@ -62,20 +62,6 @@ void pmd_init(unsigned long addr, unsigned long pagetable) | |||
62 | } | 62 | } |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
66 | |||
67 | void pmdp_splitting_flush(struct vm_area_struct *vma, | ||
68 | unsigned long address, | ||
69 | pmd_t *pmdp) | ||
70 | { | ||
71 | if (!pmd_trans_splitting(*pmdp)) { | ||
72 | pmd_t pmd = pmd_mksplitting(*pmdp); | ||
73 | set_pmd_at(vma->vm_mm, address, pmdp, pmd); | ||
74 | } | ||
75 | } | ||
76 | |||
77 | #endif | ||
78 | |||
79 | pmd_t mk_pmd(struct page *page, pgprot_t prot) | 65 | pmd_t mk_pmd(struct page *page, pgprot_t prot) |
80 | { | 66 | { |
81 | pmd_t pmd; | 67 | pmd_t pmd; |
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 32e0be27673f..482192cc8f2b 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -240,7 +240,6 @@ static void output_pgtable_bits_defines(void) | |||
240 | pr_define("_PAGE_MODIFIED_SHIFT %d\n", _PAGE_MODIFIED_SHIFT); | 240 | pr_define("_PAGE_MODIFIED_SHIFT %d\n", _PAGE_MODIFIED_SHIFT); |
241 | #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT | 241 | #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT |
242 | pr_define("_PAGE_HUGE_SHIFT %d\n", _PAGE_HUGE_SHIFT); | 242 | pr_define("_PAGE_HUGE_SHIFT %d\n", _PAGE_HUGE_SHIFT); |
243 | pr_define("_PAGE_SPLITTING_SHIFT %d\n", _PAGE_SPLITTING_SHIFT); | ||
244 | #endif | 243 | #endif |
245 | #ifdef CONFIG_CPU_MIPSR2 | 244 | #ifdef CONFIG_CPU_MIPSR2 |
246 | if (cpu_has_rixi) { | 245 | if (cpu_has_rixi) { |