Commit 1c890ad9 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] zeromap_pmd_range bugfix

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

The patch below fixes a 2.6 mm problem.  Without this patch, zeromapped
pages are not flushed properly when they are swapped out.

What happens is that the page->index field is zero for page table pages
corresponding to the zeromapped range.  This causes ptep_to_address() to
return an incorrect virtual address with the result that PTEs are never
invalidated at swap-out...

The fix below mirrors the remap_pmd_range() case.
parent 50eb14c6
......@@ -811,17 +811,18 @@ static void zeromap_pte_range(pte_t * pte, unsigned long address,
static inline int zeromap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address,
unsigned long size, pgprot_t prot)
{
unsigned long end;
unsigned long base, end;
base = address & PGDIR_MASK;
address &= ~PGDIR_MASK;
end = address + size;
if (end > PGDIR_SIZE)
end = PGDIR_SIZE;
do {
pte_t * pte = pte_alloc_map(mm, pmd, address);
pte_t * pte = pte_alloc_map(mm, pmd, base + address);
if (!pte)
return -ENOMEM;
zeromap_pte_range(pte, address, end - address, prot);
zeromap_pte_range(pte, base + address, end - address, prot);
pte_unmap(pte);
address = (address + PMD_SIZE) & PMD_MASK;
pmd++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment