mmu_notifier: Provide invalidate_range on fork On fork we change ptes in cow mappings to readonly. This means we must invalidate the ptes so that they are reestablished later with proper permission. Signed-off-by: Christoph Lameter --- mm/memory.c | 7 +++++++ 1 file changed, 7 insertions(+) Index: linux-2.6/mm/memory.c =================================================================== --- linux-2.6.orig/mm/memory.c 2008-01-31 13:42:35.000000000 -0800 +++ linux-2.6/mm/memory.c 2008-01-31 19:04:00.000000000 -0800 @@ -602,6 +602,9 @@ int copy_page_range(struct mm_struct *ds if (is_vm_hugetlb_page(vma)) return copy_hugetlb_page_range(dst_mm, src_mm, vma); + if (is_cow_mapping(vma->vm_flags)) + mmu_notifier(invalidate_range_begin, src_mm, addr, end, 0); + dst_pgd = pgd_offset(dst_mm, addr); src_pgd = pgd_offset(src_mm, addr); do { @@ -612,6 +615,10 @@ int copy_page_range(struct mm_struct *ds vma, addr, next)) return -ENOMEM; } while (dst_pgd++, src_pgd++, addr = next, addr != end); + + if (is_cow_mapping(vma->vm_flags)) + mmu_notifier(invalidate_range_end, src_mm, 0); + return 0; }