LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] mm: Add hook of freepage
@ 2011-02-06 15:08 Minchan Kim
2011-02-06 20:20 ` Rik van Riel
2011-02-07 9:37 ` Miklos Szeredi
0 siblings, 2 replies; 4+ messages in thread
From: Minchan Kim @ 2011-02-06 15:08 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, LKML, Minchan Kim, Miklos Szeredi, Rik van Riel,
KAMEZAWA Hiroyuki, Mel Gorman
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@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: Add hook of freepage
2011-02-06 15:08 [PATCH] mm: Add hook of freepage Minchan Kim
@ 2011-02-06 20:20 ` Rik van Riel
2011-02-07 9:37 ` Miklos Szeredi
1 sibling, 0 replies; 4+ messages in thread
From: Rik van Riel @ 2011-02-06 20:20 UTC (permalink / raw)
To: Minchan Kim
Cc: Andrew Morton, linux-mm, LKML, Miklos Szeredi, KAMEZAWA Hiroyuki,
Mel Gorman
On 02/06/2011 10:08 AM, Minchan Kim wrote:
> 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@suse.cz>
> Cc: Rik van Riel<riel@redhat.com>
> Cc: KAMEZAWA Hiroyuki<kamezawa.hiroyu@jp.fujitsu.com>
> Cc: Mel Gorman<mel@csn.ul.ie>
> Signed-off-by: Minchan Kim<minchan.kim@gmail.com>
Acked-by: Rik van Riel <riel@redhat.com>
--
All rights reversed
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: Add hook of freepage
2011-02-06 15:08 [PATCH] mm: Add hook of freepage Minchan Kim
2011-02-06 20:20 ` Rik van Riel
@ 2011-02-07 9:37 ` Miklos Szeredi
2011-02-08 1:28 ` Andrew Morton
1 sibling, 1 reply; 4+ messages in thread
From: Miklos Szeredi @ 2011-02-07 9:37 UTC (permalink / raw)
To: Minchan Kim
Cc: Andrew Morton, linux-mm, LKML, Rik van Riel, KAMEZAWA Hiroyuki,
Mel Gorman
On Mon, 2011-02-07 at 00:08 +0900, Minchan Kim wrote:
> 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.
Thanks Minchan for fixing this.
Acked-by: Miklos Szeredi <mszeredi@suse.cz>
>
> Cc: Miklos Szeredi <mszeredi@suse.cz>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Cc: Mel Gorman <mel@csn.ul.ie>
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> ---
> 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 {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: Add hook of freepage
2011-02-07 9:37 ` Miklos Szeredi
@ 2011-02-08 1:28 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2011-02-08 1:28 UTC (permalink / raw)
To: Miklos Szeredi
Cc: Minchan Kim, linux-mm, LKML, Rik van Riel, KAMEZAWA Hiroyuki, Mel Gorman
On Mon, 07 Feb 2011 10:37:01 +0100
Miklos Szeredi <mszeredi@suse.cz> wrote:
> On Mon, 2011-02-07 at 00:08 +0900, Minchan Kim wrote:
> > 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.
>
> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-08 1:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-06 15:08 [PATCH] mm: Add hook of freepage Minchan Kim
2011-02-06 20:20 ` Rik van Riel
2011-02-07 9:37 ` Miklos Szeredi
2011-02-08 1:28 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).