On Mon, Jun 03, 2013 at 01:02:07PM -0700, Dave Hansen wrote: > >From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> > >__remove_mapping() only deals with pages with mappings, meaning >page cache and swap cache. > >At this point, the page has been removed from the mapping's radix >tree, and we need to ensure that any fs-specific (or swap- >specific) resources are freed up. > >We will be using this function from a second location in a >following patch. > >Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> >Acked-by: Mel Gorman <mgorman@xxxxxxx> >Reviewed-by: Minchan Kim <minchan@xxxxxxxxxx> >--- Reviewed-by: Wanpeng Li <liwanp@xxxxxxxxxxxxxxxxxx> > > linux.git-davehans/mm/vmscan.c | 27 ++++++++++++++++++--------- > 1 file changed, 18 insertions(+), 9 deletions(-) > >diff -puN mm/vmscan.c~free_mapping_page mm/vmscan.c >--- linux.git/mm/vmscan.c~free_mapping_page 2013-06-03 12:41:31.155740124 -0700 >+++ linux.git-davehans/mm/vmscan.c 2013-06-03 12:41:31.159740301 -0700 >@@ -496,6 +496,23 @@ static int __remove_mapping(struct addre > return 1; > } > >+/* >+ * Release any resources the mapping had tied up in the page. >+ */ >+static void mapping_release_page(struct address_space *mapping, >+ struct page *page) >+{ >+ if (PageSwapCache(page)) { >+ swapcache_free_page_entry(page); >+ } else { >+ void (*freepage)(struct page *); >+ freepage = mapping->a_ops->freepage; >+ mem_cgroup_uncharge_cache_page(page); >+ if (freepage != NULL) >+ freepage(page); >+ } >+} >+ > static int lock_remove_mapping(struct address_space *mapping, struct page *page) > { > int ret; >@@ -509,15 +526,7 @@ static int lock_remove_mapping(struct ad > if (!ret) > return 0; > >- if (PageSwapCache(page)) { >- swapcache_free_page_entry(page); >- } else { >- void (*freepage)(struct page *); >- freepage = mapping->a_ops->freepage; >- mem_cgroup_uncharge_cache_page(page); >- if (freepage != NULL) >- freepage(page); >- } >+ mapping_release_page(mapping, page); > return ret; > } > >_ > >-- >To unsubscribe, send a message with 'unsubscribe linux-mm' in >the body to majordomo@xxxxxxxxx. For more info on Linux MM, >see: http://www.linux-mm.org/ . >Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>