All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: fix oom work when memory is under pressure
@ 2016-09-06 14:47 zhongjiang
  2016-09-09 11:44 ` Michal Hocko
  0 siblings, 1 reply; 26+ messages in thread
From: zhongjiang @ 2016-09-06 14:47 UTC (permalink / raw)
  To: akpm; +Cc: vbabka, mhocko, rientjes, linux-mm

From: zhong jiang <zhongjiang@huawei.com>

Some hungtask come up when I run the trinity, and OOM occurs
frequently.
A task hold lock to allocate memory, due to the low memory,
it will lead to oom. at the some time , it will retry because
it find that oom is in progress. but it always allocate fails,
the freed memory was taken away quickly.
The patch fix it by limit times to avoid hungtask and livelock
come up.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 mm/page_alloc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a178b1d..0dcf08b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3457,6 +3457,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	enum compact_result compact_result;
 	int compaction_retries = 0;
 	int no_progress_loops = 0;
+	int oom_failed = 0;
 
 	/*
 	 * In the slowpath, we sanity check order to avoid ever trying to
@@ -3645,8 +3646,13 @@ retry:
 	page = __alloc_pages_may_oom(gfp_mask, order, ac, &did_some_progress);
 	if (page)
 		goto got_pg;
+	else
+		oom_failed++;
+
+	/* more than limited times will drop out */
+	if (oom_failed > MAX_RECLAIM_RETRIES)
+		goto nopage;
 
-	/* Retry as long as the OOM killer is making progress */
 	if (did_some_progress) {
 		no_progress_loops = 0;
 		goto retry;
-- 
1.8.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2016-09-19 17:27 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-06 14:47 [PATCH] mm: fix oom work when memory is under pressure zhongjiang
2016-09-09 11:44 ` Michal Hocko
2016-09-12  9:51   ` zhong jiang
2016-09-12 11:13     ` Michal Hocko
2016-09-12 13:42       ` zhong jiang
2016-09-12 17:44         ` Michal Hocko
2016-09-13 13:13           ` zhong jiang
2016-09-13 13:28             ` Michal Hocko
2016-09-13 14:01               ` zhong jiang
2016-09-14  7:13               ` zhong jiang
2016-09-14  8:42                 ` Michal Hocko
2016-09-14  8:50                   ` zhong jiang
2016-09-14  9:05                     ` Michal Hocko
2016-09-14  8:52                   ` Michal Hocko
2016-09-14  9:25                     ` zhong jiang
2016-09-14 11:29                       ` Tetsuo Handa
2016-09-14 13:52                         ` zhong jiang
2016-09-18  6:00                           ` Tetsuo Handa
2016-09-18  6:13                             ` Tetsuo Handa
2016-09-19  4:44                               ` zhong jiang
2016-09-19  7:15                             ` zhong jiang
2016-09-16 22:13                     ` Hugh Dickins
2016-09-17 15:56                       ` Michal Hocko
2016-09-18  4:04                       ` zhong jiang
2016-09-18 14:42                         ` Michal Hocko
2016-09-19 17:27                           ` Hugh Dickins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.