[Devel] [PATCH RH9 03/33] ve/mm, oom: print information about ve of killed task

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Thu Sep 23 22:08:06 MSK 2021


From: Andrey Ryabinin <aryabinin at virtuozzo.com>

dmesg |grep Killed
Before:
	Killed process 14892 (trinity-c271) total-vm:97920kB, anon-rss:2508kB, file-rss:1060kB
After:
	Killed process 14892 (trinity-c271) in ve 4 total-vm:97920kB, anon-rss:2508kB, file-rss:1060kB

https://jira.sw.ru/browse/PSBM-40610

Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
Reviewed-by: Vladimir Davydov <vdavydov at virtuozzo.com>

khorenko@:
* s/ve/VE/g
* put VE name into quotes

(cherry picked from vz8 commit b4bbab464ac09fb7505893b376da0aa015044328)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 mm/oom_kill.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index c729a4c..3357763 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -36,6 +36,7 @@
 #include <linux/memcontrol.h>
 #include <linux/mempolicy.h>
 #include <linux/security.h>
+#include <linux/ve_proto.h>
 #include <linux/ptrace.h>
 #include <linux/freezer.h>
 #include <linux/ftrace.h>
@@ -889,13 +890,17 @@ static void __oom_kill_process(struct task_struct *victim, const char *message)
 	 */
 	do_send_sig_info(SIGKILL, SEND_SIG_PRIV, victim, PIDTYPE_TGID);
 	mark_oom_victim(victim);
-	pr_err("%s: Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB, UID:%u pgtables:%lukB oom_score_adj:%hd\n",
-		message, task_pid_nr(victim), victim->comm, K(mm->total_vm),
+	rcu_read_lock();
+	pr_err("%s: Killed process %d (%s) VE \"%s\" total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB, UID:%u pgtables:%lukB oom_score_adj:%hd\n",
+		message, task_pid_nr(victim), victim->comm,
+		task_ve_name(victim),
+		K(mm->total_vm),
 		K(get_mm_counter(mm, MM_ANONPAGES)),
 		K(get_mm_counter(mm, MM_FILEPAGES)),
 		K(get_mm_counter(mm, MM_SHMEMPAGES)),
 		from_kuid(&init_user_ns, task_uid(victim)),
 		mm_pgtables_bytes(mm) >> 10, victim->signal->oom_score_adj);
+	rcu_read_unlock();
 	task_unlock(victim);
 
 	/*
@@ -916,8 +921,8 @@ static void __oom_kill_process(struct task_struct *victim, const char *message)
 		if (is_global_init(p)) {
 			can_oom_reap = false;
 			set_bit(MMF_OOM_SKIP, &mm->flags);
-			pr_info("oom killer %d (%s) has mm pinned by %d (%s)\n",
-					task_pid_nr(victim), victim->comm,
+			pr_info("oom killer %d (%s) in VE \"%s\" has mm pinned by %d (%s)\n",
+					task_pid_nr(victim), victim->comm, task_ve_name(victim),
 					task_pid_nr(p), p->comm);
 			continue;
 		}
-- 
1.8.3.1



More information about the Devel mailing list