It was observed that, when OOM happened, OOM killer did not target the
"fattest" tasks first. It might have killed half of a CT's processes before
killing the tasks that actually consumed lots of memory.

This happened because the result of oom_worse() was ignored in
oom_evaluate_task(): a new task was selected even if was not worse than
the previously chosen one.

This patch fixes it.

https://jira.sw.ru/browse/PSBM-132385

Fixes: afac60108d3c "memcg: add oom_guarantee"
Signed-off-by: Evgenii Shatokhin <eshatok...@virtuozzo.com>
---
 mm/oom_kill.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index f792efdd376a..a64a9ff7391b 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -346,8 +346,8 @@ static int oom_evaluate_task(struct task_struct *task, void 
*arg)
        if (!points)
                goto next;
 
-       if (oom_worse(points, overdraft, &oc->chosen_points, 
&oc->max_overdraft))
-               goto select;
+       if (!oom_worse(points, overdraft, &oc->chosen_points, 
&oc->max_overdraft))
+               goto next;
 select:
        if (oc->chosen)
                put_task_struct(oc->chosen);
-- 
2.29.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to