linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jaeseon Sim <jason.sim@samsung.com>
To: "Liam.Howlett@Oracle.com" <Liam.Howlett@Oracle.com>
Cc: "willy@infradead.org" <willy@infradead.org>,
	"zhangpeng.00@bytedance.com" <zhangpeng.00@bytedance.com>,
	"surenb@google.com" <surenb@google.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jaewon31.kim@gmail.com" <jaewon31.kim@gmail.com>,
	"maple-tree@lists.infradead.org" <maple-tree@lists.infradead.org>,
	Jaewon Kim <jaewon31.kim@samsung.com>
Subject: [PATCH v2] maple_tree: use mas_node_count_gfp on mas_expected_entries
Date: Fri, 15 Sep 2023 18:32:43 +0900	[thread overview]
Message-ID: <20230915093243epcms1p46fa00bbac1ab7b7dca94acb66c44c456@epcms1p4> (raw)
In-Reply-To: <CGME20230915093243epcms1p46fa00bbac1ab7b7dca94acb66c44c456@epcms1p4>

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


       reply	other threads:[~2023-09-15  9:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230915093243epcms1p46fa00bbac1ab7b7dca94acb66c44c456@epcms1p4>
2023-09-15  9:32 ` Jaeseon Sim [this message]
2023-09-18 18:06   ` Liam R. Howlett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230915093243epcms1p46fa00bbac1ab7b7dca94acb66c44c456@epcms1p4 \
    --to=jason.sim@samsung.com \
    --cc=Liam.Howlett@Oracle.com \
    --cc=jaewon31.kim@gmail.com \
    --cc=jaewon31.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=surenb@google.com \
    --cc=willy@infradead.org \
    --cc=zhangpeng.00@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox