From: Kirill Tkhai <ktk...@virtuozzo.com>

Extracted from "Initial patch".

Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com>

(cherry picked from commit 78002f240e10fec47aaa4a727b5fdebba3a3e27a)
Signed-off-by: Konstantin Khorenko <khore...@virtuozzo.com>

+++
ve/proc: fix wrong output in do_task_stat()

Remove printing task_cpu, this part was lost in rebase. Before patch
we've shown extra entry in position dependant output of /proc/pid/stat,
that made criu go mad.

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

mFixes: c1b073e09d58 ("ve/proc: Show vcpu in do_task_stat()")
Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com>

(cherry picked from vz8 commit 5704aea6c379a07ffe292e0cf378b74b98380c3e)
Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com>
---
 fs/proc/array.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/proc/array.c b/fs/proc/array.c
index ee0ce8cecc4a..d726b2836c48 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -92,6 +92,7 @@
 #include <linux/string_helpers.h>
 #include <linux/user_namespace.h>
 #include <linux/fs_struct.h>
+#include <linux/ve.h>
 
 #include <asm/processor.h>
 #include "internal.h"
@@ -478,6 +479,7 @@ static int do_task_stat(struct seq_file *m, struct 
pid_namespace *ns,
        u64 cgtime, gtime;
        unsigned long rsslim = 0;
        unsigned long flags;
+       int is_super = ve_is_super(get_exec_env());
 
        state = *get_task_state(task);
        vsize = eip = esp = 0;
@@ -624,7 +626,7 @@ static int do_task_stat(struct seq_file *m, struct 
pid_namespace *ns,
        seq_put_decimal_ull(m, " ", 0);
        seq_put_decimal_ull(m, " ", 0);
        seq_put_decimal_ll(m, " ", task->exit_signal);
-       seq_put_decimal_ll(m, " ", task_cpu(task));
+       seq_put_decimal_ll(m, " ", is_super ? task_cpu(task) : 
task_vcpu_id(task));
        seq_put_decimal_ull(m, " ", task->rt_priority);
        seq_put_decimal_ull(m, " ", task->policy);
        seq_put_decimal_ull(m, " ", delayacct_blkio_ticks(task));
-- 
2.31.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to