Skip to content

Commit

Permalink
x86: CPA use the existing pfn in split as well
Browse files Browse the repository at this point in the history
When splitting large pages, we ge the pfn from the existing entry
instead of calculating it ourself.

This removes the last remaining range restriction of the cpa code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Feb 4, 2008
1 parent 626c2c9 commit 63c1dcf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions arch/x86/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ static int split_large_page(pte_t *kpte, unsigned long address)
{
pgprot_t ref_prot = pte_pgprot(pte_clrhuge(*kpte));
gfp_t gfp_flags = GFP_KERNEL;
unsigned long flags;
unsigned long addr;
unsigned long flags, addr, pfn;
pte_t *pbase, *tmp;
struct page *base;
unsigned int i, level;
Expand Down Expand Up @@ -253,8 +252,12 @@ static int split_large_page(pte_t *kpte, unsigned long address)
paravirt_alloc_pt(&init_mm, page_to_pfn(base));
#endif

for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE)
set_pte(&pbase[i], pfn_pte(addr >> PAGE_SHIFT, ref_prot));
/*
* Get the target pfn from the original entry:
*/
pfn = pte_pfn(*kpte);
for (i = 0; i < PTRS_PER_PTE; i++, pfn++)
set_pte(&pbase[i], pfn_pte(pfn, ref_prot));

/*
* Install the new, split up pagetable. Important detail here:
Expand Down

0 comments on commit 63c1dcf

Please sign in to comment.