linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm,ksm: add __GFP_HIGH to the allocation in alloc_stable_node()
@ 2016-09-20  6:54 zhongjiang
  2016-09-20 20:35 ` Hugh Dickins
  2016-09-20 21:06 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: zhongjiang @ 2016-09-20  6:54 UTC (permalink / raw)
  To: hughd, akpm, mhocko, vbabka, rientjes; +Cc: linux-mm

From: zhong jiang <zhongjiang@huawei.com>

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.

Suggested-by: Hugh Dickins <hughd@google.com>
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 mm/ksm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index 5048083..42bf16e 100644
--- 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)
-- 
1.8.3.1

--
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>

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm,ksm: add __GFP_HIGH to the allocation in alloc_stable_node()
  2016-09-20  6:54 [PATCH] mm,ksm: add __GFP_HIGH to the allocation in alloc_stable_node() zhongjiang
@ 2016-09-20 20:35 ` Hugh Dickins
  2016-09-20 21:06 ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Hugh Dickins @ 2016-09-20 20:35 UTC (permalink / raw)
  To: zhongjiang; +Cc: hughd, akpm, mhocko, vbabka, rientjes, linux-mm

On Tue, 20 Sep 2016, zhongjiang wrote:

> From: zhong jiang <zhongjiang@huawei.com>
> 
> 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.
> 
> Suggested-by: Hugh Dickins <hughd@google.com>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>

Thanks,
Acked-by: Hugh Dickins <hughd@google.com>

> ---
>  mm/ksm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 5048083..42bf16e 100644
> --- 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)
> -- 
> 1.8.3.1

--
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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm,ksm: add __GFP_HIGH to the allocation in alloc_stable_node()
  2016-09-20  6:54 [PATCH] mm,ksm: add __GFP_HIGH to the allocation in alloc_stable_node() zhongjiang
  2016-09-20 20:35 ` Hugh Dickins
@ 2016-09-20 21:06 ` Andrew Morton
  2016-09-28  2:38   ` zhong jiang
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2016-09-20 21:06 UTC (permalink / raw)
  To: zhongjiang; +Cc: hughd, mhocko, vbabka, rientjes, linux-mm

On Tue, 20 Sep 2016 14:54:44 +0800 zhongjiang <zhongjiang@huawei.com> wrote:

> From: zhong jiang <zhongjiang@huawei.com>
> 
> 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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm,ksm: add __GFP_HIGH to the allocation in alloc_stable_node()
  2016-09-20 21:06 ` Andrew Morton
@ 2016-09-28  2:38   ` zhong jiang
  0 siblings, 0 replies; 4+ messages in thread
From: zhong jiang @ 2016-09-28  2:38 UTC (permalink / raw)
  To: Andrew Morton; +Cc: hughd, mhocko, vbabka, rientjes, linux-mm

On 2016/9/21 5:06, Andrew Morton wrote:
> On Tue, 20 Sep 2016 14:54:44 +0800 zhongjiang <zhongjiang@huawei.com> wrote:
>
>> From: zhong jiang <zhongjiang@huawei.com>
>>
>> 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.
  ok,  I will add  some code comment later.
> --
> 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>
>
>


--
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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-28  2:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-20  6:54 [PATCH] mm,ksm: add __GFP_HIGH to the allocation in alloc_stable_node() zhongjiang
2016-09-20 20:35 ` Hugh Dickins
2016-09-20 21:06 ` Andrew Morton
2016-09-28  2:38   ` zhong jiang

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).