Modify try_to_unmap to produce swap migration entries If we are trying to unmap an entry and do not have an associated swapcache entry but are doing migration then create a special swap pte of type SWP_TYPE_MIGRATION pointing to the pfn. Signed-off-by: Christoph Lameter Index: linux-2.6.16-mm2/mm/rmap.c =================================================================== --- linux-2.6.16-mm2.orig/mm/rmap.c 2006-03-31 09:24:04.000000000 -0800 +++ linux-2.6.16-mm2/mm/rmap.c 2006-03-31 09:25:12.000000000 -0800 @@ -620,6 +620,17 @@ static int try_to_unmap_one(struct page if (PageAnon(page)) { swp_entry_t entry = { .val = page_private(page) }; + + if (!PageSwapCache(page) && migration) { + /* + * Store the pfn of the page in a special migration + * pte. do_swap_page() will wait until the page is unlocked + * and then restart the fault handling. + */ + entry = swp_entry(SWP_TYPE_MIGRATION, page_to_pfn(page)); + set_pte_at(mm, address, pte, swp_entry_to_pte(entry)); + goto finish; + } /* * Store the swap location in the pte. * See handle_pte_fault() ... @@ -638,6 +649,7 @@ static int try_to_unmap_one(struct page } else dec_mm_counter(mm, file_rss); +finish: page_remove_rmap(page); page_cache_release(page);