Index: linux-2.6/mm/memory.c =================================================================== --- linux-2.6.orig/mm/memory.c 2008-01-03 13:56:13.000000000 -0800 +++ linux-2.6/mm/memory.c 2008-01-03 14:14:57.000000000 -0800 @@ -766,7 +766,7 @@ static unsigned long unmap_page_range(st zap_work, details); } while (pgd++, addr = next, (addr != end && *zap_work > 0)); tlb_end_vma(tlb, vma); - + xmem_end_vma(vma); return addr; } @@ -886,9 +886,11 @@ unsigned long zap_page_range(struct vm_a lru_add_drain(); tlb = tlb_gather_mmu(mm, 0); update_hiwater_rss(mm); + xmem_start_shutdown(mm, address, size); end = unmap_vmas(&tlb, vma, address, end, &nr_accounted, details); if (tlb) tlb_finish_mmu(tlb, address, end); + xmem_end_shutdown(mm, address, size); return end; } @@ -1605,6 +1607,7 @@ static int do_wp_page(struct mm_struct * } if (reuse) { + xmem_remove_remote_refs(old_page); flush_cache_page(vma, address, pte_pfn(orig_pte)); entry = pte_mkyoung(orig_pte); entry = maybe_mkwrite(pte_mkdirty(entry), vma); Index: linux-2.6/mm/mprotect.c =================================================================== --- linux-2.6.orig/mm/mprotect.c 2008-01-03 14:05:13.000000000 -0800 +++ linux-2.6/mm/mprotect.c 2008-01-03 14:05:57.000000000 -0800 @@ -242,6 +242,7 @@ sys_mprotect(unsigned long start, size_t vm_flags = calc_vm_prot_bits(prot); + xmem_remove_remote_refs(current->mm, start, len); down_write(¤t->mm->mmap_sem); vma = find_vma_prev(current->mm, start, &prev); Index: linux-2.6/mm/rmap.c =================================================================== --- linux-2.6.orig/mm/rmap.c 2008-01-03 14:01:42.000000000 -0800 +++ linux-2.6/mm/rmap.c 2008-01-03 14:11:00.000000000 -0800 @@ -472,6 +472,7 @@ int page_mkclean(struct page *page) if (page_mapped(page)) { struct address_space *mapping = page_mapping(page); if (mapping) { + xmem_remove_remote_refs(page); ret = page_mkclean_file(mapping, page); if (page_test_dirty(page)) { page_clear_dirty(page); @@ -966,6 +967,7 @@ int try_to_unmap(struct page *page, int BUG_ON(!PageLocked(page)); + xmem_remove_remote_refers(page); if (PageAnon(page)) ret = try_to_unmap_anon(page, migration); else