From: Jianfeng Wang <jianfeng.w.wang@oracle.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Jianfeng Wang <jianfeng.w.wang@oracle.com>
Subject: [PATCH] mm, oom: Add lru_add_drain() in __oom_reap_task_mm()
Date: Tue, 9 Jan 2024 01:15:11 -0800 [thread overview]
Message-ID: <20240109091511.8299-1-jianfeng.w.wang@oracle.com> (raw)
The oom_reaper tries to reclaim additional memory owned by the oom
victim. In __oom_reap_task_mm(), it uses mmu_gather for batched page
free. After oom_reaper was added, mmu_gather feature introduced
CONFIG_MMU_GATHER_NO_GATHER (in 'commit 952a31c9e6fa ("asm-generic/tlb:
Introduce CONFIG_HAVE_MMU_GATHER_NO_GATHER=y")', an option to skip batched
page free. If set, tlb_batch_pages_flush(), which is responsible for
calling lru_add_drain(), is skipped during tlb_finish_mmu(). Without it,
pages could still be held by per-cpu fbatches rather than be freed.
This fix adds lru_add_drain() prior to mmu_gather. This makes the code
consistent with other cases where mmu_gather is used for freeing pages.
Signed-off-by: Jianfeng Wang <jianfeng.w.wang@oracle.com>
---
mm/oom_kill.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 9e6071fde34a..e2fcf4f062ea 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -537,6 +537,7 @@ static bool __oom_reap_task_mm(struct mm_struct *mm)
struct mmu_notifier_range range;
struct mmu_gather tlb;
+ lru_add_drain();
mmu_notifier_range_init(&range, MMU_NOTIFY_UNMAP, 0,
mm, vma->vm_start,
vma->vm_end);
--
2.42.1
next reply other threads:[~2024-01-09 9:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 9:15 Jianfeng Wang [this message]
2024-01-10 8:46 ` [PATCH] mm, oom: Add lru_add_drain() in __oom_reap_task_mm() Michal Hocko
2024-01-10 19:02 ` Jianfeng Wang
2024-01-11 8:46 ` Michal Hocko
2024-01-11 18:54 ` Jianfeng Wang
2024-01-11 21:54 ` Andrew Morton
2024-01-12 0:08 ` [External] : " Jianfeng Wang
2024-01-12 8:49 ` Michal Hocko
2024-01-12 21:43 ` Minchan Kim
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=20240109091511.8299-1-jianfeng.w.wang@oracle.com \
--to=jianfeng.w.wang@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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;
as well as URLs for NNTP newsgroup(s).