Thread (4 messages) 4 messages, 3 authors, 2016-09-28

Re: [PATCH] mm,ksm: add __GFP_HIGH to the allocation in alloc_stable_node()

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2016-09-20 21:06:41

On Tue, 20 Sep 2016 14:54:44 +0800 zhongjiang [off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: zhong jiang <redacted>

Accoding to HUgh's suggestion, alloc_stable_node() with GFP_KERNEL
will cause the hungtask, despite less possiblity.

At present, if alloc_stable_node allocate fails, two break_cow may
want to allocate a couple of pages, and the issue will come up when
free memory is under pressure.

we fix it by adding the __GFP_HIGH to GFP. because it grant access to
some of meory reserves. it will make progess to make it allocation
successful at the utmost.
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -299,7 +299,7 @@ static inline void free_rmap_item(struct rmap_item *rmap_item)
 
 static inline struct stable_node *alloc_stable_node(void)
 {
-	return kmem_cache_alloc(stable_node_cache, GFP_KERNEL);
+	return kmem_cache_alloc(stable_node_cache, GFP_KERNEL | __GFP_HIGH);
 }
 
 static inline void free_stable_node(struct stable_node *stable_node)
It is very hard for a reader to understand why this __GFP_HIGH is being
used here, so we should have a code comment explaining the reasoning,
please.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help