mm: Add hook of freepage
Subsystems (2)
PATCH 1/1 mm: Add hook of freepage
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.
--- mm/filemap.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
mm/filemap.c +5 -0
@@ -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 {
Signature · 1 line
1.7.1
Quoted 4 lines · Minchan Kim
Recently, "Call the filesystem back whenever a page is removed from the page cache(6072d13c)" added new freepage hook in page cache drop function.
Quoted 8 lines
So,
replace_page_cache_pageshould call freepage to support page cleanup to fs.Cc Miklos Szeredi<[email protected]>Cc Rik van Riel<[email protected]>Cc KAMEZAWA Hiroyuki<[email protected]>Cc Mel Gorman<[email protected]>Signed-off-by Minchan Kim<[email protected]>
Signature · 8 lines
All rights reversed -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. 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:"[email protected]"> [email protected] </a>
Quoted 6 lines · Minchan Kim
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_pageshould call freepage to support page cleanup to fs.
Thanks Minchan for fixing this.
Quoted 34 lines
Cc Miklos Szeredi <[email protected]>Cc Rik van Riel <[email protected]>Cc KAMEZAWA Hiroyuki <[email protected]>Cc Mel Gorman <[email protected]>Signed-off-by Minchan Kim <[email protected]>--- mm/filemap.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)mm/filemap.c +5
-0@@ -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 {
Andrew Morton
maintainerQuoted 9 lines · On Mon, 07 Feb 2011 10:37:01 +0100 Miklos Szeredi <[email protected]> wrote:
Quoted 6 lines · Minchan Kim
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_pageshould call freepage to support page cleanup to fs.Thanks Minchan for fixing this.
What's happening with mm-add-replace_page_cache_page-function.patch, btw? When last discussed nearly three weeks ago we had identified:
1) remove radix_tree_preload
2) single radix_tree_lookup_slot and replace radix tree slot
3) page accounting optimization if both pages are in same zone.