diff options
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/mm/pageattr.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c index 37992ffb1633..8927222b3ab2 100644 --- a/arch/i386/mm/pageattr.c +++ b/arch/i386/mm/pageattr.c | |||
@@ -82,7 +82,7 @@ static void flush_kernel_map(void *arg) | |||
82 | struct page *p; | 82 | struct page *p; |
83 | 83 | ||
84 | /* High level code is not ready for clflush yet */ | 84 | /* High level code is not ready for clflush yet */ |
85 | if (0 && cpu_has_clflush) { | 85 | if (cpu_has_clflush) { |
86 | list_for_each_entry (p, lh, lru) | 86 | list_for_each_entry (p, lh, lru) |
87 | cache_flush_page(p); | 87 | cache_flush_page(p); |
88 | } else if (boot_cpu_data.x86_model >= 4) | 88 | } else if (boot_cpu_data.x86_model >= 4) |
@@ -136,6 +136,12 @@ static inline void revert_page(struct page *kpte_page, unsigned long address) | |||
136 | ref_prot)); | 136 | ref_prot)); |
137 | } | 137 | } |
138 | 138 | ||
139 | static inline void save_page(struct page *kpte_page) | ||
140 | { | ||
141 | if (!test_and_set_bit(PG_arch_1, &kpte_page->flags)) | ||
142 | list_add(&kpte_page->lru, &df_list); | ||
143 | } | ||
144 | |||
139 | static int | 145 | static int |
140 | __change_page_attr(struct page *page, pgprot_t prot) | 146 | __change_page_attr(struct page *page, pgprot_t prot) |
141 | { | 147 | { |
@@ -150,6 +156,9 @@ __change_page_attr(struct page *page, pgprot_t prot) | |||
150 | if (!kpte) | 156 | if (!kpte) |
151 | return -EINVAL; | 157 | return -EINVAL; |
152 | kpte_page = virt_to_page(kpte); | 158 | kpte_page = virt_to_page(kpte); |
159 | BUG_ON(PageLRU(kpte_page)); | ||
160 | BUG_ON(PageCompound(kpte_page)); | ||
161 | |||
153 | if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) { | 162 | if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) { |
154 | if (!pte_huge(*kpte)) { | 163 | if (!pte_huge(*kpte)) { |
155 | set_pte_atomic(kpte, mk_pte(page, prot)); | 164 | set_pte_atomic(kpte, mk_pte(page, prot)); |
@@ -179,11 +188,11 @@ __change_page_attr(struct page *page, pgprot_t prot) | |||
179 | * time (not via split_large_page) and in turn we must not | 188 | * time (not via split_large_page) and in turn we must not |
180 | * replace it with a largepage. | 189 | * replace it with a largepage. |
181 | */ | 190 | */ |
191 | |||
192 | save_page(kpte_page); | ||
182 | if (!PageReserved(kpte_page)) { | 193 | if (!PageReserved(kpte_page)) { |
183 | if (cpu_has_pse && (page_private(kpte_page) == 0)) { | 194 | if (cpu_has_pse && (page_private(kpte_page) == 0)) { |
184 | ClearPagePrivate(kpte_page); | ||
185 | paravirt_release_pt(page_to_pfn(kpte_page)); | 195 | paravirt_release_pt(page_to_pfn(kpte_page)); |
186 | list_add(&kpte_page->lru, &df_list); | ||
187 | revert_page(kpte_page, address); | 196 | revert_page(kpte_page, address); |
188 | } | 197 | } |
189 | } | 198 | } |
@@ -236,6 +245,11 @@ void global_flush_tlb(void) | |||
236 | spin_unlock_irq(&cpa_lock); | 245 | spin_unlock_irq(&cpa_lock); |
237 | flush_map(&l); | 246 | flush_map(&l); |
238 | list_for_each_entry_safe(pg, next, &l, lru) { | 247 | list_for_each_entry_safe(pg, next, &l, lru) { |
248 | list_del(&pg->lru); | ||
249 | clear_bit(PG_arch_1, &pg->flags); | ||
250 | if (PageReserved(pg) || !cpu_has_pse || page_private(pg) != 0) | ||
251 | continue; | ||
252 | ClearPagePrivate(pg); | ||
239 | __free_page(pg); | 253 | __free_page(pg); |
240 | } | 254 | } |
241 | } | 255 | } |