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 --- memhotplug-dave/include/linux/swap.h | 30 ++++++++++++++++++++++++++++++ memhotplug-dave/mm/vmscan.c | 32 +------------------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff -puN include/linux/swap.h~AA-PM-18-export_shrink_list include/linux/swap.h --- memhotplug/include/linux/swap.h~AA-PM-18-export_shrink_list 2005-03-11 10:51:58.000000000 -0800 +++ memhotplug-dave/include/linux/swap.h 2005-03-11 10:51:58.000000000 -0800 @@ -185,6 +185,36 @@ 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; +}; +extern int shrink_list(struct list_head *, struct scan_control *); extern int vm_swappiness; #ifdef CONFIG_MMU diff -puN mm/vmscan.c~AA-PM-18-export_shrink_list mm/vmscan.c --- memhotplug/mm/vmscan.c~AA-PM-18-export_shrink_list 2005-03-11 10:51:58.000000000 -0800 +++ memhotplug-dave/mm/vmscan.c 2005-03-11 10:51:58.000000000 -0800 @@ -39,36 +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; - - /* 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. @@ -339,7 +309,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; _