[PATCH] mm: Add hook of freepage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Recently, "Call the filesystem back whenever a page is removed from
the page cache(6072d13c)" added new freepage hook in page cache
drop function.

So, replace_page_cache_page should call freepage to support
page cleanup to fs.

Cc: Miklos Szeredi <mszeredi@xxxxxxx>
Cc: Rik van Riel <riel@xxxxxxxxxx>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
Cc: Mel Gorman <mel@xxxxxxxxx>
Signed-off-by: Minchan Kim <minchan.kim@xxxxxxxxx>
---
 mm/filemap.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 3c89c96..a25c898 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -436,7 +436,10 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
 	error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
 	if (!error) {
 		struct address_space *mapping = old->mapping;
+		void (*freepage)(struct page *);
+
 		pgoff_t offset = old->index;
+		freepage = mapping->a_ops->freepage;
 
 		page_cache_get(new);
 		new->mapping = mapping;
@@ -452,6 +455,8 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
 			__inc_zone_page_state(new, NR_SHMEM);
 		spin_unlock_irq(&mapping->tree_lock);
 		radix_tree_preload_end();
+		if (freepage)
+			freepage(old);
 		page_cache_release(old);
 		mem_cgroup_end_migration(memcg, old, new, true);
 	} else {
-- 
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]