aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/mm/pageattr_32.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-30 13:33:43 +0100
committerIngo Molnar <mingo@elte.hu>2008-01-30 13:33:43 +0100
commitf0646e43acb18f0e00b00085dc88bc3f403e7930 (patch)
treec47968a44ac541854929f03d22cf2fb76d76cb55 /arch/x86/mm/pageattr_32.c
parenta5a5dc31794c3271c066835ad2c90c58a3805569 (diff)
x86: return the page table level in lookup_address()
based on this patch from Andi Kleen: | Subject: CPA: Return the page table level in lookup_address() | From: Andi Kleen <ak@suse.de> | | Needed for the next change. | | And change all the callers. and ported it to x86.git. Signed-off-by: Andi Kleen <ak@suse.de> Acked-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm/pageattr_32.c')
-rw-r--r--arch/x86/mm/pageattr_32.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/mm/pageattr_32.c b/arch/x86/mm/pageattr_32.c
index be4656403d7..523fd5b37df 100644
--- a/arch/x86/mm/pageattr_32.c
+++ b/arch/x86/mm/pageattr_32.c
@@ -18,7 +18,7 @@
static DEFINE_SPINLOCK(cpa_lock);
static struct list_head df_list = LIST_HEAD_INIT(df_list);
-pte_t *lookup_address(unsigned long address)
+pte_t *lookup_address(unsigned long address, int *level)
{
pgd_t *pgd = pgd_offset_k(address);
pud_t *pud;
@@ -32,8 +32,10 @@ pte_t *lookup_address(unsigned long address)
pmd = pmd_offset(pud, address);
if (pmd_none(*pmd))
return NULL;
+ *level = 2;
if (pmd_large(*pmd))
return (pte_t *)pmd;
+ *level = 3;
return pte_offset_kernel(pmd, address);
}
@@ -156,11 +158,12 @@ static int __change_page_attr(struct page *page, pgprot_t prot)
struct page *kpte_page;
unsigned long address;
pte_t *kpte;
+ int level;
BUG_ON(PageHighMem(page));
address = (unsigned long)page_address(page);
- kpte = lookup_address(address);
+ kpte = lookup_address(address, &level);
if (!kpte)
return -EINVAL;