[linux-mm-cc] [PATCH 05/12] avoid OOM : store mapping pointer in chunk_head

IKEDA Munehiro m-ikeda at ds.jp.nec.com
Fri Jul 20 06:45:00 EDT 2007


fs_backed_ccache area should be shrunk under memory pressure.
chunk_head has to have a pointer to an address_space which
owns the compressed page cache to be freed.


Signed-off-by: IKEDA, Munehiro <m-ikeda at ds.jp.nec.com>
---
 include/linux/ccache.h |    1 +
 mm/ccache.c            |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/ccache.h b/include/linux/ccache.h
index 31e3b49..d4c1897 100644
--- a/include/linux/ccache.h
+++ b/include/linux/ccache.h
@@ -112,6 +112,7 @@ struct chunk_head {
 				 * page->private for anon pages */
 	struct chunk *chunk_list;	/* point to first chunk */
 	struct list_head lru;		/* to add to one of LRU lists */
+	struct address_space *mapping;
 };
 
 struct chunk {
diff --git a/mm/ccache.c b/mm/ccache.c
index c043581..94b8dbb 100644
--- a/mm/ccache.c
+++ b/mm/ccache.c
@@ -782,6 +782,7 @@ int cc_writepage(struct page *page)
 	ClearPageLocked(ch);		/* NOTE: again, only for chunk_head */
 	SetPageCompressed(ch);
 	set_algo_idx(ch, algo_idx);
+	ch->mapping = mapping;
 	atomic_set(&ch->_count, 1);	/* page/swap cache ref */
 	
 	/* replace radix node with chunk_head */
-- 
1.4.4.4






More information about the linux-mm-cc mailing list