linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] maple_tree: use mas_node_count_gfp on mas_expected_entries
       [not found] <CGME20230915093243epcms1p46fa00bbac1ab7b7dca94acb66c44c456@epcms1p4>
@ 2023-09-15  9:32 ` Jaeseon Sim
  2023-09-18 18:06   ` Liam R. Howlett
  0 siblings, 1 reply; 2+ messages in thread
From: Jaeseon Sim @ 2023-09-15  9:32 UTC (permalink / raw)
  To: Liam.Howlett
  Cc: willy, zhangpeng.00, surenb, linux-mm, linux-kernel,
	jaewon31.kim, maple-tree, Jaewon Kim

Use mas_node_count_gfp with GFP_KERNEL instead of 
GFP_NOWAIT | __GFP_NOWARN on mas_expected_entries 
in order to allow memory reclaim.

Currently, fork errors occur on low free memory as follows:

 Zygote  : Failed to fork child process: Out of memory (12)

-ENOMEM was returned as following path:

 mas_node_count
 mas_expected_entries
 dup_mmap
 dup_mm
 copy_mm
 copy_process

Signed-off-by: Jaeseon Sim <jason.sim@samsung.com>
---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index ee1ff0c59fd7..b0229271c24e 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -5574,7 +5574,7 @@ int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries)
 	/* Internal nodes */
 	nr_nodes += DIV_ROUND_UP(nr_nodes, nonleaf_cap);
 	/* Add working room for split (2 nodes) + new parents */
-	mas_node_count(mas, nr_nodes + 3);
+	mas_node_count_gfp(mas, nr_nodes + 3, GFP_KERNEL);
 
 	/* Detect if allocations run out */
 	mas->mas_flags |= MA_STATE_PREALLOC;
-- 
2.17.1

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

* Re: [PATCH v2] maple_tree: use mas_node_count_gfp on mas_expected_entries
  2023-09-15  9:32 ` [PATCH v2] maple_tree: use mas_node_count_gfp on mas_expected_entries Jaeseon Sim
@ 2023-09-18 18:06   ` Liam R. Howlett
  0 siblings, 0 replies; 2+ messages in thread
From: Liam R. Howlett @ 2023-09-18 18:06 UTC (permalink / raw)
  To: Jaeseon Sim
  Cc: willy, zhangpeng.00, surenb, linux-mm, linux-kernel,
	jaewon31.kim, maple-tree, Jaewon Kim

Sorry for the late reply.

* Jaeseon Sim <jason.sim@samsung.com> [230915 05:32]:
> Use mas_node_count_gfp with GFP_KERNEL instead of 
> GFP_NOWAIT | __GFP_NOWARN on mas_expected_entries 
> in order to allow memory reclaim.
> 
> Currently, fork errors occur on low free memory as follows:
> 
>  Zygote  : Failed to fork child process: Out of memory (12)
> 
> -ENOMEM was returned as following path:
> 
>  mas_node_count
>  mas_expected_entries
>  dup_mmap
>  dup_mm
>  copy_mm
>  copy_process
> 
> Signed-off-by: Jaeseon Sim <jason.sim@samsung.com>

Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>

> ---
>  lib/maple_tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index ee1ff0c59fd7..b0229271c24e 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -5574,7 +5574,7 @@ int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries)
>  	/* Internal nodes */
>  	nr_nodes += DIV_ROUND_UP(nr_nodes, nonleaf_cap);
>  	/* Add working room for split (2 nodes) + new parents */
> -	mas_node_count(mas, nr_nodes + 3);
> +	mas_node_count_gfp(mas, nr_nodes + 3, GFP_KERNEL);
>  
>  	/* Detect if allocations run out */
>  	mas->mas_flags |= MA_STATE_PREALLOC;
> -- 
> 2.17.1

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

end of thread, other threads:[~2023-09-18 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20230915093243epcms1p46fa00bbac1ab7b7dca94acb66c44c456@epcms1p4>
2023-09-15  9:32 ` [PATCH v2] maple_tree: use mas_node_count_gfp on mas_expected_entries Jaeseon Sim
2023-09-18 18:06   ` Liam R. Howlett

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