[Devel] [PATCH RHEL8 COMMIT] oom: Fix task selection in oom_evaluate_task()

Konstantin Khorenko khorenko at virtuozzo.com
Thu Aug 12 14:12:37 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.vz8.7.5
------>
commit 949eb3348b7b1d7308860db824e68c2ee171dfc8
Author: Evgenii Shatokhin <eshatokhin at virtuozzo.com>
Date:   Thu Aug 12 14:12:37 2021 +0300

    oom: Fix task selection in oom_evaluate_task()
    
    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"
    Feature: mm: OOM guarantee
    
    Signed-off-by: Evgenii Shatokhin <eshatokhin at 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);


More information about the Devel mailing list