linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] oom: break after selecting process to kill
@ 2014-09-11 21:33 Niv Yehezkel
  2014-09-12  1:22 ` Zhang Zhen
  2014-09-12  8:08 ` Michal Hocko
  0 siblings, 2 replies; 10+ messages in thread
From: Niv Yehezkel @ 2014-09-11 21:33 UTC (permalink / raw)
  To: linux-mm, akpm, rientjes, mhocko, hannes, oleg

There is no need to fallback and continue computing
badness for each running process after we have found a
process currently performing the swapoff syscall. We ought to
immediately select this process for killing.

Signed-off-by: Niv Yehezkel <executerx@gmail.com>
---
 mm/oom_kill.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 1e11df8..68ac30e 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -305,6 +305,7 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
 	struct task_struct *g, *p;
 	struct task_struct *chosen = NULL;
 	unsigned long chosen_points = 0;
+	bool process_selected = false;
 
 	rcu_read_lock();
 	for_each_process_thread(g, p) {
@@ -315,7 +316,8 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
 		case OOM_SCAN_SELECT:
 			chosen = p;
 			chosen_points = ULONG_MAX;
-			/* fall through */
+			process_selected = true;
+			break;
 		case OOM_SCAN_CONTINUE:
 			continue;
 		case OOM_SCAN_ABORT:
@@ -324,6 +326,8 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
 		case OOM_SCAN_OK:
 			break;
 		};
+		if (process_selected)
+			break;
 		points = oom_badness(p, NULL, nodemask, totalpages);
 		if (!points || points < chosen_points)
 			continue;
-- 
1.7.10.4

--
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] 10+ messages in thread

end of thread, other threads:[~2014-09-23 18:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11 21:33 [PATCH] oom: break after selecting process to kill Niv Yehezkel
2014-09-12  1:22 ` Zhang Zhen
2014-09-12  7:39   ` Niv Yehezkel
2014-09-12  8:08 ` Michal Hocko
2014-09-12  8:23   ` Niv Yehezkel
2014-09-12 12:18     ` Michal Hocko
2014-09-12 12:21       ` Niv Yehezkel
2014-09-12 12:31         ` Michal Hocko
2014-09-14 20:46         ` David Rientjes
2014-09-23 18:30           ` Michal Hocko

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).