[PATCH openEuler-1.0-LTS] mm: mem_reliable: prevent excessive direct reclaim loops
hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/5441 ------------------------------------------ In our testing, under memory pressure, it becomes difficult totrigger an OOM(out-of-memory) kill when regular memory allocation competes concurrently with driver GFP_ATOMIC allocations. This occurs because GFP_ATOMIC allocations can succeed from as low as 3/8 of the min watermark. In such a situation, even if direct reclaim can free a small number of pages, regular memory requests may still fail because the current watermark remains too high for them. In the following scenario: restart: __alloc_pages_direct_reclaim // reclaims a small number of pages should_reclaim_retry // watermark too high for user // resets no_progress_loops to zero and // goes to restart goto restart; In our production environment, we encountered a case where memory allocation performed __alloc_pages_direct_reclaim 257 times without either succeeding or triggering OOM, causing service freezes. To avoid meaningless continuous direct reclaim loops, skip watermark check for non mirrored zone if memory reliable enabled. Fixes: 33d1f46ad98e ("mm: Introduce memory reliable") Signed-off-by: Wupeng Ma <mawupeng1@huawei.com> --- mm/page_alloc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 787bbabc29d0..c2577d3048d9 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4256,6 +4256,9 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order, unsigned long min_wmark = min_wmark_pages(zone); bool wmark; + if (skip_none_movable_zone(gfp_mask, z)) + continue; + available = reclaimable = zone_reclaimable_pages(zone); available += zone_page_state_snapshot(zone, NR_FREE_PAGES); -- 2.43.0
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://atomgit.com/openeuler/kernel/merge_requests/19910 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/NBX... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://atomgit.com/openeuler/kernel/merge_requests/19910 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/NBX...
participants (2)
-
patchwork bot -
Wupeng Ma