Hi,

have you had to time to see it?

thanks,
Hiroshi

> Subject: [PATCH] cputime: fix invalid gtime
> 
> From: Hiroshi Shimamoto <h-shimam...@ct.jp.nec.com>
> 
> /proc/stats shows invalid gtime when the thread is running in guest.
> When vtime accounting is not enabled, we cannot get a valid delta.
> 
> Just return gtime when vtime accounting is not enabled in task_gtime().
> 
> Before
> 10987 (qemu-kvm) S 1 10923 10923 0 -1 138428608 7521 0 90 0 3776 460 0 0 20 0 
> 24 0 11960 8090398720 151288 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 9 0 0 0 3554 0 
> 0 0 0 0 0 0 0 0
> 10987 (qemu-kvm) S 1 10923 10923 0 -1 138428608 7521 0 90 0 3776 460 0 0 20 0 
> 17 0 11960 8031649792 150268 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 9 0 0 0 3554 0 
> 0 0 0 0 0 0 0 0
> 10987 (qemu-kvm) R 1 10923 10923 0 -1 138428624 7521 0 90 0 3843 460 0 0 20 0 
> 17 0 11960 8031649792 150268 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 9 0 0 0 21415 0 
> 0 0 0 0 0 0 0 0
> 10987 (qemu-kvm) R 1 10923 10923 0 -1 138428624 7521 0 90 0 3943 460 0 0 20 0 
> 17 0 11960 8031649792 150268 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 9 0 0 0 21616 0 
> 0 0 0 0 0 0 0 0
> 10987 (qemu-kvm) R 1 10923 10923 0 -1 138428624 7521 0 90 0 4044 460 0 0 20 0 
> 17 0 11960 8031649792 150268 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 9 0 0 0 21816 0 
> 0 0 0 0 0 0 0 0
> 10987 (qemu-kvm) R 1 10923 10923 0 -1 138428624 7521 0 90 0 4144 460 0 0 20 0 
> 17 0 11960 8031649792 150268 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 9 0 0 0 22017 0 
> 0 0 0 0 0 0 0 0
> 10987 (qemu-kvm) R 1 10923 10923 0 -1 138428624 7521 0 90 0 4245 460 0 0 20 0 
> 11 0 11960 7981293568 149758 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 9 0 0 0 22218 0 
> 0 0 0 0 0 0 0 0
> 10987 (qemu-kvm) S 1 10923 10923 0 -1 138428608 7521 0 90 0 4308 460 0 0 20 0 
> 11 0 11960 7981293568 149758 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 9 0 0 0 4084 0 
> 0 0 0 0 0 0 0 0
> 
> After
> 10845 (qemu-kvm) S 1 10792 10792 0 -1 138428608 202 0 0 0 2858 30 0 0 20 0 29 
> 0 7676 8511279104 148187 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 3 0 0 0 2874 0 
> 0 0 0 0 0 0 0 0
> 10845 (qemu-kvm) S 1 10792 10792 0 -1 138428608 202 0 0 0 2858 30 0 0 20 0 29 
> 0 7676 8511279104 148187 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 3 0 0 0 2874 0 
> 0 0 0 0 0 0 0 0
> 10845 (qemu-kvm) R 1 10792 10792 0 -1 138428624 203 0 0 0 2936 30 0 0 20 0 29 
> 0 7676 8511279104 148187 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 3 0 0 0 2952 0 
> 0 0 0 0 0 0 0 0
> 10845 (qemu-kvm) R 1 10792 10792 0 -1 138428624 203 0 0 0 3037 30 0 0 20 0 29 
> 0 7676 8511279104 152184 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 3 0 0 0 3052 0 
> 0 0 0 0 0 0 0 0
> 10845 (qemu-kvm) R 1 10792 10792 0 -1 138428624 203 0 0 0 3137 30 0 0 20 0 29 
> 0 7676 8511279104 152184 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 3 0 0 0 3152 0 
> 0 0 0 0 0 0 0 0
> 10845 (qemu-kvm) R 1 10792 10792 0 -1 138428624 203 0 0 0 3237 30 0 0 20 0 27 
> 0 7676 8511279104 152188 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 3 0 0 0 3252 0 
> 0 0 0 0 0 0 0 0
> 10845 (qemu-kvm) S 1 10792 10792 0 -1 138428608 203 0 0 0 3262 31 0 0 20 0 11 
> 0 7676 8393781248 151156 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 3 0 0 0 3277 0 
> 0 0 0 0 0 0 0 0
> 10845 (qemu-kvm) S 1 10792 10792 0 -1 138428608 203 0 0 0 3262 31 0 0 20 0 11 
> 0 7676 8393781248 151156 18446744073709551615
> 1 1 0 0 0 0 2147220671 4096 25155 18446744073709551615 0 0 -1 3 0 0 0 3277 0 
> 0 0 0 0 0 0 0 0
> 
> Signed-off-by: Hiroshi Shimamoto <h-shimam...@ct.jp.nec.com>
> ---
>  kernel/sched/cputime.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
> index 8cbc3db..f614ee9 100644
> --- a/kernel/sched/cputime.c
> +++ b/kernel/sched/cputime.c
> @@ -786,6 +786,9 @@ cputime_t task_gtime(struct task_struct *t)
>       unsigned int seq;
>       cputime_t gtime;
> 
> +     if (!vtime_accounting_enabled())
> +             return t->gtime;
> +
>       do {
>               seq = read_seqbegin(&t->vtime_seqlock);
> 
> --
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to