[Devel] [PATCH RHEL COMMIT] ve/mm: print OOM info to VE log

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 4 16:43:19 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit a75997bfb3c958e7fff914daa2796bd147e6535e
Author: Vladimir Davydov <vdavydov.dev at gmail.com>
Date:   Mon Oct 4 16:43:18 2021 +0300

    ve/mm: print OOM info to VE log
    
    We cannot print to VE log from oom_kill_process as we do in RH6, because
    there is no more set_exec_env, so do it from exit_mm.
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    
    (cherry picked from vz8 commit 046f7c4bcc5a205de02c5193db33016f98f4c5a6)
    Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 kernel/exit.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/kernel/exit.c b/kernel/exit.c
index 6903dc21dc88..d7b901c6b07a 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -448,6 +448,20 @@ static void exit_mm(void)
 	if (!mm)
 		return;
 	sync_mm_rss(mm);
+
+#ifdef CONFIG_VE
+#define K(x) ((x) << (PAGE_SHIFT-10))
+	if (!ve_is_super(current->task_ve) &&
+	    test_tsk_thread_flag(current, TIF_MEMDIE))
+		ve_printk(VE_LOG, KERN_ERR "OOM killed process %d (%s) "
+			  "total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB\n",
+			  task_pid_vnr(current), current->comm,
+			  K(mm->total_vm),
+			  K(get_mm_counter(mm, MM_ANONPAGES)),
+			  K(get_mm_counter(mm, MM_FILEPAGES)));
+#undef K
+#endif
+
 	/*
 	 * Serialize with any possible pending coredump.
 	 * We must hold mmap_lock around checking core_state


More information about the Devel mailing list