diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:34:00 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:34:00 -0500 |
commit | a5c62514885a778016c03dbba833d4ff6786e30c (patch) | |
tree | fbfafd9c971ac3d349d0b465f301487fe23912eb | |
parent | 5e5224a77eb4c68a982c8096945b0af902f9d655 (diff) |
x86: clean up and simplify 64-bit split_large_page()
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/mm/pageattr_64.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/x86/mm/pageattr_64.c b/arch/x86/mm/pageattr_64.c index 107b03c7113c..cbded8300e36 100644 --- a/arch/x86/mm/pageattr_64.c +++ b/arch/x86/mm/pageattr_64.c | |||
@@ -46,7 +46,7 @@ pte_t *lookup_address(unsigned long address, int *level) | |||
46 | } | 46 | } |
47 | 47 | ||
48 | static struct page * | 48 | static struct page * |
49 | split_large_page(unsigned long address, pgprot_t prot, pgprot_t ref_prot) | 49 | split_large_page(unsigned long address, pgprot_t ref_prot) |
50 | { | 50 | { |
51 | unsigned long addr; | 51 | unsigned long addr; |
52 | struct page *base; | 52 | struct page *base; |
@@ -60,10 +60,9 @@ split_large_page(unsigned long address, pgprot_t prot, pgprot_t ref_prot) | |||
60 | address = __pa(address); | 60 | address = __pa(address); |
61 | addr = address & LARGE_PAGE_MASK; | 61 | addr = address & LARGE_PAGE_MASK; |
62 | pbase = (pte_t *)page_address(base); | 62 | pbase = (pte_t *)page_address(base); |
63 | for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) { | 63 | for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) |
64 | pbase[i] = pfn_pte(addr >> PAGE_SHIFT, | 64 | pbase[i] = pfn_pte(addr >> PAGE_SHIFT, ref_prot); |
65 | addr == address ? prot : ref_prot); | 65 | |
66 | } | ||
67 | return base; | 66 | return base; |
68 | } | 67 | } |
69 | 68 | ||
@@ -76,6 +75,7 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot, | |||
76 | pgprot_t ref_prot2, oldprot; | 75 | pgprot_t ref_prot2, oldprot; |
77 | int level; | 76 | int level; |
78 | 77 | ||
78 | repeat: | ||
79 | kpte = lookup_address(address, &level); | 79 | kpte = lookup_address(address, &level); |
80 | if (!kpte) | 80 | if (!kpte) |
81 | return 0; | 81 | return 0; |
@@ -98,12 +98,12 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot, | |||
98 | struct page *split; | 98 | struct page *split; |
99 | 99 | ||
100 | ref_prot2 = pte_pgprot(pte_clrhuge(*kpte)); | 100 | ref_prot2 = pte_pgprot(pte_clrhuge(*kpte)); |
101 | split = split_large_page(address, prot, ref_prot2); | 101 | split = split_large_page(address, ref_prot2); |
102 | if (!split) | 102 | if (!split) |
103 | return -ENOMEM; | 103 | return -ENOMEM; |
104 | pgprot_val(ref_prot2) &= ~_PAGE_NX; | 104 | pgprot_val(ref_prot2) &= ~_PAGE_NX; |
105 | set_pte(kpte, mk_pte(split, ref_prot2)); | 105 | set_pte(kpte, mk_pte(split, ref_prot2)); |
106 | kpte_page = split; | 106 | goto repeat; |
107 | } | 107 | } |
108 | } else { | 108 | } else { |
109 | if (level == 4) { | 109 | if (level == 4) { |