This patch exports shrink_list() function. Memory migration code calls the function to free inactive pages. Signed-off-by: Hirokazu Takahashi Signed-off-by: Dave Hansen Index: linux-2.6.13/include/linux/swap.h =================================================================== --- linux-2.6.13.orig/include/linux/swap.h 2005-08-30 12:16:50.000000000 -0700 +++ linux-2.6.13/include/linux/swap.h 2005-08-30 12:17:15.000000000 -0700 @@ -187,6 +187,39 @@ typedef enum { PAGE_CLEAN, } pageout_t; extern pageout_t pageout(struct page *, struct address_space *); +struct scan_control { + /* Ask refill_inactive_zone, or shrink_cache to scan this many pages */ + unsigned long nr_to_scan; + + /* Incremented by the number of inactive pages that were scanned */ + unsigned long nr_scanned; + + /* Incremented by the number of pages reclaimed */ + unsigned long nr_reclaimed; + + unsigned long nr_mapped; /* From page_state */ + + /* How many pages shrink_cache() should reclaim */ + int nr_to_reclaim; + + /* Ask shrink_caches, or shrink_zone to scan at this priority */ + unsigned int priority; + + /* This context's GFP mask */ + unsigned int gfp_mask; + + int may_writepage; + + /* This context's SWAP_CLUSTER_MAX. If freeing memory for + * suspend, we effectively ignore SWAP_CLUSTER_MAX. + * In this context, it doesn't matter that we scan the + * whole list at once. */ + int swap_cluster_max; + + /* Can pages be swapped as part of reclaim? */ + int may_swap; +}; +extern int shrink_list(struct list_head *, struct scan_control *); extern int vm_swappiness; #ifdef CONFIG_MMU Index: linux-2.6.13/mm/vmscan.c =================================================================== --- linux-2.6.13.orig/mm/vmscan.c 2005-08-30 12:16:48.000000000 -0700 +++ linux-2.6.13/mm/vmscan.c 2005-08-30 12:17:15.000000000 -0700 @@ -39,39 +39,6 @@ #include -struct scan_control { - /* Ask refill_inactive_zone, or shrink_cache to scan this many pages */ - unsigned long nr_to_scan; - - /* Incremented by the number of inactive pages that were scanned */ - unsigned long nr_scanned; - - /* Incremented by the number of pages reclaimed */ - unsigned long nr_reclaimed; - - unsigned long nr_mapped; /* From page_state */ - - /* How many pages shrink_cache() should reclaim */ - int nr_to_reclaim; - - /* Ask shrink_caches, or shrink_zone to scan at this priority */ - unsigned int priority; - - /* This context's GFP mask */ - unsigned int gfp_mask; - - int may_writepage; - - /* Can pages be swapped as part of reclaim? */ - int may_swap; - - /* This context's SWAP_CLUSTER_MAX. If freeing memory for - * suspend, we effectively ignore SWAP_CLUSTER_MAX. - * In this context, it doesn't matter that we scan the - * whole list at once. */ - int swap_cluster_max; -}; - /* * The list of shrinker callbacks used by to apply pressure to * ageable caches. @@ -361,7 +328,7 @@ pageout_t pageout(struct page *page, str /* * shrink_list adds the number of reclaimed pages to sc->nr_reclaimed */ -static int shrink_list(struct list_head *page_list, struct scan_control *sc) +int shrink_list(struct list_head *page_list, struct scan_control *sc) { LIST_HEAD(ret_pages); struct pagevec freed_pvec;