The commit is pushed to "branch-rh7-3.10.0-1160.42.2.vz7.184.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.42.2.vz7.184.3
------>
commit 55623f7a08317a509036ac42980873a7e62bfc82
Author: Vasily Averin <v...@virtuozzo.com>
Date:   Tue Oct 26 18:18:58 2021 +0300

    ms/mm, oom: pagefault_out_of_memory: don't force global OOM for dying tasks
    
    Any allocation failure during the #PF path will return with VM_FAULT_OOM
    which in turn results in pagefault_out_of_memory which in own turn
    executes out_out_memory() and can kill a random task.
    
    An allocation might fail when the current task is the oom victim
    and there are no memory reserves left. The OOM killer is already
    handled at the page allocator level for the global OOM and at the
    charging level for the memcg one. Both have much more information
    about the scope of allocation/charge request. This means that
    either the OOM killer has been invoked properly and didn't lead
    to the allocation success or it has been skipped because it couldn't
    have been invoked. In both cases triggering it from here is pointless
    and even harmful.
    
    It makes much more sense to let the killed task die rather than to
    wake up an eternally hungry oom-killer and send him to choose a fatter
    victim for breakfast.
    
    [VvS: it is not critical for vz7,
    however it helps to avoid an extra kills during global OOM]
    Suggested-by: Michal Hocko <mho...@suse.com>
    Signed-off-by: Vasily Averin <v...@virtuozzo.com>
---
 mm/oom_kill.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 0668b2d..74beb3a 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -1072,6 +1072,9 @@ void pagefault_out_of_memory(void)
        if (mem_cgroup_oom_synchronize(true))
                return;
 
+       if (fatal_signal_pending(current))
+               return;
+
        if (oom_trylock(NULL)) {
                out_of_memory(NULL, 0, 0, NULL);
                oom_unlock(NULL);
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to