[PATCH] mm: move_pte to remap ZERO_PAGE
Move the ZERO_PAGE remapping complexity to the move_pte macro in asm-generic, have it conditionally depend on __HAVE_ARCH_MULTIPLE_ZERO_PAGE, which gets defined for MIPS. For architectures without __HAVE_ARCH_MULTIPLE_ZERO_PAGE, move_pte becomes a noop. From: Hugh Dickins <hugh@veritas.com> Fix nasty little bug we've missed in Nick's mremap move ZERO_PAGE patch. The "pte" at that point may be a swap entry or a pte_file entry: we must check pte_present before perhaps corrupting such an entry. Patch below against 2.6.14-rc2-mm1, but the same bug is in 2.6.14-rc2's mm/mremap.c, and more dangerous there since it's affecting all arches: I think the safest course is to send Nick's patch and Yoichi's build fix and this fix (build tested) on to Linus - so only MIPS can be affected. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
95001ee925
commit
8b1f312461
@ -141,10 +141,10 @@ move_one_page(struct vm_area_struct *vma, unsigned long old_addr,
|
||||
if (dst) {
|
||||
pte_t pte;
|
||||
pte = ptep_clear_flush(vma, old_addr, src);
|
||||
|
||||
/* ZERO_PAGE can be dependant on virtual addr */
|
||||
if (pfn_valid(pte_pfn(pte)) &&
|
||||
pte_page(pte) == ZERO_PAGE(old_addr))
|
||||
pte = pte_wrprotect(mk_pte(ZERO_PAGE(new_addr), new_vma->vm_page_prot));
|
||||
pte = move_pte(pte, new_vma->vm_page_prot,
|
||||
old_addr, new_addr);
|
||||
set_pte_at(mm, new_addr, dst, pte);
|
||||
} else
|
||||
error = -ENOMEM;
|
||||
|
Reference in New Issue
Block a user