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

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Mon Oct 4 12:38:29 MSK 2021


From: Vladimir Davydov <vdavydov at parallels.com>

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 6903dc2..d7b901c 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
-- 
1.8.3.1



More information about the Devel mailing list