diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-02-04 10:48:09 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-02-04 10:48:09 -0500 |
commit | 9df84993cb3d71669894654ab257f01f6e4ed48e (patch) | |
tree | 08e8c80dd35d465e59c002a50e1baf27f5eb1496 /arch/x86/mm | |
parent | f07333fd149eb6826da26a89c3aff90324f270b0 (diff) |
x86: cpa, cleanups
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/pageattr.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 42ca3d8effad..029fb07b3f03 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -16,6 +16,9 @@ | |||
16 | #include <asm/uaccess.h> | 16 | #include <asm/uaccess.h> |
17 | #include <asm/pgalloc.h> | 17 | #include <asm/pgalloc.h> |
18 | 18 | ||
19 | /* | ||
20 | * The current flushing context - we pass it instead of 5 arguments: | ||
21 | */ | ||
19 | struct cpa_data { | 22 | struct cpa_data { |
20 | unsigned long vaddr; | 23 | unsigned long vaddr; |
21 | pgprot_t mask_set; | 24 | pgprot_t mask_set; |
@@ -206,6 +209,7 @@ pte_t *lookup_address(unsigned long address, int *level) | |||
206 | 209 | ||
207 | if (pgd_none(*pgd)) | 210 | if (pgd_none(*pgd)) |
208 | return NULL; | 211 | return NULL; |
212 | |||
209 | pud = pud_offset(pgd, address); | 213 | pud = pud_offset(pgd, address); |
210 | if (pud_none(*pud)) | 214 | if (pud_none(*pud)) |
211 | return NULL; | 215 | return NULL; |
@@ -223,9 +227,13 @@ pte_t *lookup_address(unsigned long address, int *level) | |||
223 | return (pte_t *)pmd; | 227 | return (pte_t *)pmd; |
224 | 228 | ||
225 | *level = PG_LEVEL_4K; | 229 | *level = PG_LEVEL_4K; |
230 | |||
226 | return pte_offset_kernel(pmd, address); | 231 | return pte_offset_kernel(pmd, address); |
227 | } | 232 | } |
228 | 233 | ||
234 | /* | ||
235 | * Set the new pmd in all the pgds we know about: | ||
236 | */ | ||
229 | static void __set_pmd_pte(pte_t *kpte, unsigned long address, pte_t pte) | 237 | static void __set_pmd_pte(pte_t *kpte, unsigned long address, pte_t pte) |
230 | { | 238 | { |
231 | /* change init_mm */ | 239 | /* change init_mm */ |
@@ -248,8 +256,9 @@ static void __set_pmd_pte(pte_t *kpte, unsigned long address, pte_t pte) | |||
248 | #endif | 256 | #endif |
249 | } | 257 | } |
250 | 258 | ||
251 | static int try_preserve_large_page(pte_t *kpte, unsigned long address, | 259 | static int |
252 | struct cpa_data *cpa) | 260 | try_preserve_large_page(pte_t *kpte, unsigned long address, |
261 | struct cpa_data *cpa) | ||
253 | { | 262 | { |
254 | unsigned long nextpage_addr, numpages, pmask, psize, flags; | 263 | unsigned long nextpage_addr, numpages, pmask, psize, flags; |
255 | pte_t new_pte, old_pte, *tmp; | 264 | pte_t new_pte, old_pte, *tmp; |
@@ -341,17 +350,18 @@ static int try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
341 | 350 | ||
342 | out_unlock: | 351 | out_unlock: |
343 | spin_unlock_irqrestore(&pgd_lock, flags); | 352 | spin_unlock_irqrestore(&pgd_lock, flags); |
353 | |||
344 | return res; | 354 | return res; |
345 | } | 355 | } |
346 | 356 | ||
347 | static int split_large_page(pte_t *kpte, unsigned long address) | 357 | static int split_large_page(pte_t *kpte, unsigned long address) |
348 | { | 358 | { |
349 | pgprot_t ref_prot; | ||
350 | gfp_t gfp_flags = GFP_KERNEL; | ||
351 | unsigned long flags, addr, pfn, pfninc = 1; | 359 | unsigned long flags, addr, pfn, pfninc = 1; |
360 | gfp_t gfp_flags = GFP_KERNEL; | ||
361 | unsigned int i, level; | ||
352 | pte_t *pbase, *tmp; | 362 | pte_t *pbase, *tmp; |
363 | pgprot_t ref_prot; | ||
353 | struct page *base; | 364 | struct page *base; |
354 | unsigned int i, level; | ||
355 | 365 | ||
356 | #ifdef CONFIG_DEBUG_PAGEALLOC | 366 | #ifdef CONFIG_DEBUG_PAGEALLOC |
357 | gfp_flags = GFP_ATOMIC | __GFP_NOWARN; | 367 | gfp_flags = GFP_ATOMIC | __GFP_NOWARN; |
@@ -505,7 +515,6 @@ repeat: | |||
505 | * | 515 | * |
506 | * Modules and drivers should use the set_memory_* APIs instead. | 516 | * Modules and drivers should use the set_memory_* APIs instead. |
507 | */ | 517 | */ |
508 | |||
509 | static int change_page_attr_addr(struct cpa_data *cpa) | 518 | static int change_page_attr_addr(struct cpa_data *cpa) |
510 | { | 519 | { |
511 | int err; | 520 | int err; |