From: Rui Qi <qirui.001@bytedance.com>
To: linmiaohe@huawei.com, nao.horiguchi@gmail.com, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Rui Qi <qirui.001@bytedance.com>
Subject: [PATCH] mm/memory-failure: allow memory allocation from emergency reserves
Date: Tue, 25 Jun 2024 10:23:42 +0800 [thread overview]
Message-ID: <20240625022342.6158-1-qirui.001@bytedance.com> (raw)
From: Rui Qi <qirui.001@bytedance.com>
we hope that memory errors can be successfully handled quickly, using
__GFP_MEMALLOC can help us improve the success rate of processing
under memory pressure, because to_kill struct is freed very quickly,
so using __GFP_MEMALLOC will not exacerbate memory pressure for a long time,
and more memory will be freed after killed task exiting, which will also
reduce memory pressure.
Signed-off-by: Rui Qi <qirui.001@bytedance.com>
---
mm/memory-failure.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 05818d09b4eb..0608383f927a 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -451,7 +451,7 @@ static void __add_to_kill(struct task_struct *tsk, struct page *p,
{
struct to_kill *tk;
- tk = kmalloc(sizeof(struct to_kill), GFP_ATOMIC);
+ tk = kmalloc(sizeof(struct to_kill), GFP_ATOMIC | __GFP_MEMALLOC);
if (!tk) {
pr_err("Out of memory while machine check handling\n");
return;
@@ -1931,7 +1931,7 @@ static int folio_set_hugetlb_hwpoison(struct folio *folio, struct page *page)
return -EHWPOISON;
}
- raw_hwp = kmalloc(sizeof(struct raw_hwp_page), GFP_ATOMIC);
+ raw_hwp = kmalloc(sizeof(struct raw_hwp_page), GFP_ATOMIC | __GFP_MEMALLOC);
if (raw_hwp) {
raw_hwp->page = page;
llist_add(&raw_hwp->node, head);
--
2.39.3 (Apple Git-145)
next reply other threads:[~2024-06-25 2:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 2:23 Rui Qi [this message]
2024-06-25 20:01 ` Andrew Morton
2024-06-29 2:09 ` Miaohe Lin
2024-07-02 7:19 ` Andrew Morton
2024-07-02 8:04 ` Miaohe Lin
2024-07-04 23:26 ` Andrew Morton
2024-07-05 1:04 ` Miaohe Lin
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=20240625022342.6158-1-qirui.001@bytedance.com \
--to=qirui.001@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nao.horiguchi@gmail.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