Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80470
b: refs/heads/master
c: 97f99fe
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Jan 30, 2008
1 parent 4fa9e14 commit a8b2b15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 78c94abaea55df7003f3ad0e5b6c78ee1cc860bb
refs/heads/master: 97f99fedf27f337e2d3d95ca01e321beb26edc3d
14 changes: 8 additions & 6 deletions trunk/arch/x86/mm/pageattr_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pte_t *lookup_address(unsigned long address, int *level)
}

static struct page *
split_large_page(unsigned long address, pgprot_t prot, pgprot_t ref_prot)
split_large_page(unsigned long address, pgprot_t ref_prot)
{
unsigned long addr;
struct page *base;
Expand All @@ -58,10 +58,9 @@ split_large_page(unsigned long address, pgprot_t prot, pgprot_t ref_prot)
pbase = (pte_t *)page_address(base);
paravirt_alloc_pt(&init_mm, page_to_pfn(base));

for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) {
set_pte(&pbase[i], pfn_pte(addr >> PAGE_SHIFT,
addr == address ? prot : ref_prot));
}
for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE)
set_pte(&pbase[i], pfn_pte(addr >> PAGE_SHIFT, ref_prot));

return base;
}

Expand Down Expand Up @@ -101,6 +100,7 @@ static int __change_page_attr(struct page *page, pgprot_t prot)
BUG_ON(PageHighMem(page));
address = (unsigned long)page_address(page);

repeat:
kpte = lookup_address(address, &level);
if (!kpte)
return -EINVAL;
Expand Down Expand Up @@ -128,14 +128,16 @@ static int __change_page_attr(struct page *page, pgprot_t prot)
set_pte_atomic(kpte, mk_pte(page, prot));
} else {
struct page *split;
split = split_large_page(address, prot, ref_prot);

split = split_large_page(address, ref_prot);
if (!split)
return -ENOMEM;

/*
* There's a small window here to waste a bit of RAM:
*/
set_pmd_pte(kpte, address, mk_pte(split, ref_prot));
goto repeat;
}
return 0;
}
Expand Down

0 comments on commit a8b2b15

Please sign in to comment.