Skip to contentSkip to conversation

New zone ZONE_EASY_RECLAIM take 4. (disable gfp_easy_reclaim bit)[5/8]

PATCH In review Yasunori Goto 3 participants 7 messages Dec 20, 2005 – Jan 6, 2006

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 New zone ZONE_EASY_RECLAIM take 4. (disable gfp_easy_reclaim bit)[5/8]

This patch is to disable __GFP_EASY_RECLAIM at some part. The parts are followings.

1) add_to_page_cache()
2) pipe_writev()
3) shmem_dir_alloc()
4) page_symlink()

1) If this patch is not applied, cache_grow() checks and call BUG(), at here.

	if (flags & ~(SLAB_DMA|SLAB_LEVEL_MASK|SLAB_NO_GROW))
		BUG();

This patch is to solve it.

2) This page is allocated by alloc_pages(GFP_HIGHUSER) directly, and it is kmapped when it is accessed as inode.
But, it is not reclaimed by anyone.

3) This page is used for directory for shmem. So, it is very hard to reclaim.

4) Same with 2).

take3 -> take 4:
Add disable part to pipe, shmem, and symlink.

mm/filemap.c +1 -1
Index: zone_reclaim/mm/filemap.c
===================================================================
@@ -395,7 +395,7 @@ int filemap_write_and_wait_range(struct 
 int add_to_page_cache(struct page *page, struct address_space *mapping,
 		pgoff_t offset, gfp_t gfp_mask)
 {
-	int error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
+	int error = radix_tree_preload(gfp_mask & ~(__GFP_HIGHMEM | __GFP_EASY_RECLAIM));
 
 	if (error == 0) {
 		write_lock_irq(&mapping->tree_lock);
fs/pipe.c +1 -1
Index: zone_reclaim/fs/pipe.c
===================================================================
@@ -284,7 +284,7 @@ pipe_writev(struct file *filp, const str
 			int error;
 
 			if (!page) {
-				page = alloc_page(GFP_HIGHUSER);
+				page = alloc_page(GFP_HIGHUSER & ~__GFP_EASY_RECLAIM);
 				if (unlikely(!page)) {
 					ret = ret ? : -ENOMEM;
 					break;
mm/shmem.c +1 -0
Index: zone_reclaim/mm/shmem.c
===================================================================
@@ -89,6 +89,7 @@ static inline struct page *shmem_dir_all
 	 * BLOCKS_PER_PAGE on indirect pages, assume PAGE_CACHE_SIZE:
 	 * might be reconsidered if it ever diverges from PAGE_SIZE.
 	 */
+	gfp_mask &= ~__GFP_EASY_RECLAIM;
 	return alloc_pages(gfp_mask, PAGE_CACHE_SHIFT-PAGE_SHIFT);
 }
 
fs/namei.c +3 -1
Index: zone_reclaim/fs/namei.c
===================================================================
@@ -2502,10 +2502,12 @@ void page_put_link(struct dentry *dentry
 int page_symlink(struct inode *inode, const char *symname, int len)
 {
 	struct address_space *mapping = inode->i_mapping;
-	struct page *page = grab_cache_page(mapping, 0);
+	struct page *page;
 	int err = -ENOMEM;
 	char *kaddr;
 
+	mapping_set_gfp_mask(mapping, mapping_gfp_mask(mapping) & ~__GFP_EASY_RECLAIM);
+	page = grab_cache_page(mapping, 0);
 	if (!page)
 		goto fail;
 	err = mapping->a_ops->prepare_write(NULL, page, 0, len-1);
Signature · 8 lines
Yasunori Goto 


--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

fs/pipe.c pipe_writev(struct file *filp, const str · line 290

Quoted 12 lines

===================================================================

fs/pipe.c +1 -1
@@ -284,7 +284,7 @@ pipe_writev(struct file *filp, const str
 			int error;
 
 			if (!page) {
-				page = alloc_page(GFP_HIGHUSER);
+				page = alloc_page(GFP_HIGHUSER & ~__GFP_EASY_RECLAIM);
 				if (unlikely(!page)) {
 					ret = ret ? : -ENOMEM;
 					break;

That is a bit hard to understand. How about a new GFP_HIGHUSER_HARD or somesuch define back in patch 1, then use it here?

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 7 lines
Quoted 7 lines

===================================================================

fs/pipe.c +0 -0
@@ -284,7 +284,7 @@ pipe_writev(struct file *filp, const str
 			int error;
 
Quoted 9 lines

fs/pipe.c pipe_writev(struct file *filp, const str · line 290

Quoted 6 lines
fs/pipe.c +1 -1
 			if (!page) {
-				page = alloc_page(GFP_HIGHUSER);
+				page = alloc_page(GFP_HIGHUSER & ~__GFP_EASY_RECLAIM);
 				if (unlikely(!page)) {
 					ret = ret ? : -ENOMEM;
 					break;

That is a bit hard to understand. How about a new GFP_HIGHUSER_HARD or somesuch define back in patch 1, then use it here?

It looks better. Thanks for your idea.

Signature · 8 lines
Yasunori Goto 


--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#3 lore raw

On (05/01/06 14:43), Yasunori Goto didst pronounce:

Quoted 17 lines
Quoted 7 lines
Quoted 7 lines

===================================================================

fs/pipe.c +0 -0
@@ -284,7 +284,7 @@ pipe_writev(struct file *filp, const str
 			int error;
 
Quoted 9 lines

fs/pipe.c pipe_writev(struct file *filp, const str · line 290

Quoted 6 lines
fs/pipe.c +1 -1
 			if (!page) {
-				page = alloc_page(GFP_HIGHUSER);
+				page = alloc_page(GFP_HIGHUSER & ~__GFP_EASY_RECLAIM);
 				if (unlikely(!page)) {
 					ret = ret ? : -ENOMEM;
 					break;

That is a bit hard to understand. How about a new GFP_HIGHUSER_HARD or somesuch define back in patch 1, then use it here?

Quoted 2 lines

It looks better. Thanks for your idea.

There are other places where GFP_HIGHUSER is used for pages that are not easily reclaimed. It is easier clearer to add __GFP_EASY_RECLAIM at the places you know pages are easily reclaimed rather than removing __GFP_EASY_RECLAIM from awkward places.

Signature · 9 lines
Mel Gorman
Part-time Phd Student
University of Limerick                         IBM Dublin Software Lab

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#4 lore raw
Quoted 18 lines

On (05/01/06 14:43), Yasunori Goto didst pronounce:

Quoted 17 lines
Quoted 16 lines

fs/pipe.c pipe_writev(struct file *filp, const str · line 290

Quoted 13 lines

===================================================================

fs/pipe.c +1 -1
@@ -284,7 +284,7 @@ pipe_writev(struct file *filp, const str
 			int error;
 
 			if (!page) {
-				page = alloc_page(GFP_HIGHUSER);
+				page = alloc_page(GFP_HIGHUSER & ~__GFP_EASY_RECLAIM);
 				if (unlikely(!page)) {
 					ret = ret ? : -ENOMEM;
 					break;

That is a bit hard to understand. How about a new GFP_HIGHUSER_HARD or somesuch define back in patch 1, then use it here?

Quoted 7 lines
Quoted 2 lines

It looks better. Thanks for your idea.

There are other places where GFP_HIGHUSER is used for pages that are not easily reclaimed. It is easier clearer to add __GFP_EASY_RECLAIM at the places you know pages are easily reclaimed rather than removing __GFP_EASY_RECLAIM from awkward places.

I thought that other pages can be migrated by Chlistoph-san's (and Kame-san's) patch. May I ask which page should be no EASY_RECLAIM? Am I overlooking anything?

Thanks.

Signature · 8 lines
Yasunori Goto 


--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#5 lore raw

On (05/01/06 19:59), Yasunori Goto didst pronounce:

Quoted 21 lines
Quoted 21 lines

On (05/01/06 14:43), Yasunori Goto didst pronounce:

Quoted 19 lines
Quoted 7 lines
Quoted 7 lines

===================================================================

fs/pipe.c +0 -0
@@ -284,7 +284,7 @@ pipe_writev(struct file *filp, const str
 			int error;
 
Quoted 9 lines

fs/pipe.c pipe_writev(struct file *filp, const str · line 290

Quoted 6 lines
fs/pipe.c +1 -1
 			if (!page) {
-				page = alloc_page(GFP_HIGHUSER);
+				page = alloc_page(GFP_HIGHUSER & ~__GFP_EASY_RECLAIM);
 				if (unlikely(!page)) {
 					ret = ret ? : -ENOMEM;
 					break;

That is a bit hard to understand. How about a new GFP_HIGHUSER_HARD or somesuch define back in patch 1, then use it here?

It looks better. Thanks for your idea.

Quoted 7 lines
Quoted 4 lines

There are other places where GFP_HIGHUSER is used for pages that are not easily reclaimed. It is easier clearer to add __GFP_EASY_RECLAIM at the places you know pages are easily reclaimed rather than removing __GFP_EASY_RECLAIM from awkward places.

I thought that other pages can be migrated by Chlistoph-san's (and Kame-san's) patch.

Then the pages are not "easily reclaimed", they can just be moved by some other mechanism.

Quoted 1 line

May I ask which page should be no EASY_RECLAIM?

Based on http://lxr.linux.no/ident?i=GFP_HIGHUSER, examples include HugeTLB pages, pages allocated by the infiniband driver, pages allocated by the NFS driver and inode pages.

Signature · 9 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#6 lore raw
Quoted 27 lines

On (05/01/06 19:59), Yasunori Goto didst pronounce:

Quoted 26 lines
Quoted 25 lines

On (05/01/06 14:43), Yasunori Goto didst pronounce:

Quoted 17 lines
Quoted 7 lines
Quoted 7 lines

===================================================================

fs/pipe.c +0 -0
@@ -284,7 +284,7 @@ pipe_writev(struct file *filp, const str
 			int error;
 
Quoted 9 lines

fs/pipe.c pipe_writev(struct file *filp, const str · line 290

Quoted 6 lines
fs/pipe.c +1 -1
 			if (!page) {
-				page = alloc_page(GFP_HIGHUSER);
+				page = alloc_page(GFP_HIGHUSER & ~__GFP_EASY_RECLAIM);
 				if (unlikely(!page)) {
 					ret = ret ? : -ENOMEM;
 					break;

That is a bit hard to understand. How about a new GFP_HIGHUSER_HARD or somesuch define back in patch 1, then use it here?

Quoted 2 lines

It looks better. Thanks for your idea.

There are other places where GFP_HIGHUSER is used for pages that are not easily reclaimed. It is easier clearer to add __GFP_EASY_RECLAIM at the places you know pages are easily reclaimed rather than removing __GFP_EASY_RECLAIM from awkward places.

Quoted 5 lines
Quoted 2 lines

I thought that other pages can be migrated by Chlistoph-san's (and Kame-san's) patch.

Then the pages are not "easily reclaimed", they can just be moved by some other mechanism.

Ah. My naming was no good. :-(

Quoted 5 lines
Quoted 1 line

May I ask which page should be no EASY_RECLAIM?

Based on http://lxr.linux.no/ident?i=GFP_HIGHUSER, examples include HugeTLB pages, pages allocated by the infiniband driver, pages allocated by the NFS driver and inode pages.

Hmmmm.
Ok. Your proposal looks better.

Thanks.

Signature · 8 lines
Yasunori Goto 


--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>