[Devel] [PATCH rh7] mm: print OOM info to VE log

Vladimir Davydov vdavydov at parallels.com
Wed Jun 3 09:54:42 PDT 2015


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>
---
 kernel/exit.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/kernel/exit.c b/kernel/exit.c
index 52ce91e1f04b..3e79c217e150 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -465,6 +465,19 @@ static void exit_mm(struct task_struct * tsk)
 	if (!mm)
 		return;
 	sync_mm_rss(mm);
+
+#ifdef CONFIG_VE
+#define K(x) ((x) << (PAGE_SHIFT-10))
+	if (tsk->task_ve != &ve0 &&
+	    test_tsk_thread_flag(tsk, 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(tsk), tsk->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_sem around checking core_state
-- 
2.1.4




More information about the Devel mailing list