Add migration swap type Signed-off-by: Christoph Lameter Index: linux-2.6.16-mm2/mm/swap_state.c =================================================================== --- linux-2.6.16-mm2.orig/mm/swap_state.c 2006-03-30 21:21:06.000000000 -0800 +++ linux-2.6.16-mm2/mm/swap_state.c 2006-03-30 22:57:25.000000000 -0800 @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -300,6 +301,13 @@ struct page * lookup_swap_cache(swp_entr { struct page *page; + /* + * If the swap type is SWP_TYPE_MIGRATION then the + * swap entry contains the pfn of a page. + */ + if (swp_type(entry) == SWP_TYPE_MIGRATION) + return pfn_to_page(swp_offset(entry)); + page = find_get_page(&swapper_space, entry.val); if (page) Index: linux-2.6.16-mm2/mm/swapfile.c =================================================================== --- linux-2.6.16-mm2.orig/mm/swapfile.c 2006-03-30 21:21:06.000000000 -0800 +++ linux-2.6.16-mm2/mm/swapfile.c 2006-03-30 22:57:25.000000000 -0800 @@ -395,6 +395,9 @@ void free_swap_and_cache(swp_entry_t ent struct swap_info_struct * p; struct page *page = NULL; + if (swp_type(entry) == SWP_TYPE_MIGRATION) + return; + p = swap_info_get(entry); if (p) { if (swap_entry_free(p, swp_offset(entry)) == 1) @@ -1704,6 +1707,9 @@ int swap_duplicate(swp_entry_t entry) int result = 0; type = swp_type(entry); + if (type == SWP_TYPE_MIGRATION) + return 1; + if (type >= nr_swapfiles) goto bad_file; p = type + swap_info; Index: linux-2.6.16-mm2/include/linux/swap.h =================================================================== --- linux-2.6.16-mm2.orig/include/linux/swap.h 2006-03-30 21:21:05.000000000 -0800 +++ linux-2.6.16-mm2/include/linux/swap.h 2006-03-30 22:57:25.000000000 -0800 @@ -29,7 +29,10 @@ static inline int current_is_kswapd(void * the type/offset into the pte as 5/27 as well. */ #define MAX_SWAPFILES_SHIFT 5 -#define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT) +#define MAX_SWAPFILES ((1 << MAX_SWAPFILES_SHIFT)-1) + +/* Use last entry for page migration swap entries */ +#define SWP_TYPE_MIGRATION MAX_SWAPFILES /* * Magic header for a swap area. The first part of the union is