Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1227069 > unrolled thread

Re: [PATCH] cputime: fix invalid gtime

Started byPeter Zijlstra <peterz@infradead.org>
First post2015-09-17 16:30 +0200
Last post2015-09-18 01:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] cputime: fix invalid gtime Peter Zijlstra <peterz@infradead.org> - 2015-09-17 16:30 +0200
    RE: [PATCH] cputime: fix invalid gtime Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> - 2015-09-18 01:50 +0200

#1227069 — Re: [PATCH] cputime: fix invalid gtime

FromPeter Zijlstra <peterz@infradead.org>
Date2015-09-17 16:30 +0200
SubjectRe: [PATCH] cputime: fix invalid gtime
Message-ID<q9Ime-6cb-5@gated-at.bofh.it>
On Thu, Sep 03, 2015 at 12:45:50AM +0000, Hiroshi Shimamoto wrote:
> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> 
> /proc/stats shows invalid gtime when the thread is running in guest.

Why is this a problem?

> When vtime accounting is not enabled, we cannot get a valid delta.
> Just return gtime when vtime accounting is not enabled in task_gtime().

But isn't other stuff then also broken, like fetch_task_cputime(). Tell
me more about why you think your patch is the right one.

> 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

It would have been helpful if you'd used a small script to take out the
right column. As is I've no clue which field to look at.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1227483

FromHiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Date2015-09-18 01:50 +0200
Message-ID<q9R69-2bw-3@gated-at.bofh.it>
In reply to#1227069
> Subject: Re: [PATCH] cputime: fix invalid gtime
> 
> On Thu, Sep 03, 2015 at 12:45:50AM +0000, Hiroshi Shimamoto wrote:
> > From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> >
> > /proc/stats shows invalid gtime when the thread is running in guest.
> 
> Why is this a problem?

In host, when I monitored cpu usage in guest I noticed that the cpu time
is not stable.

> 
> > When vtime accounting is not enabled, we cannot get a valid delta.
> > Just return gtime when vtime accounting is not enabled in task_gtime().
> 
> But isn't other stuff then also broken, like fetch_task_cputime(). Tell
> me more about why you think your patch is the right one.

No, because I think vtime_snap_whence keeps VTIME_SLEEPING until
vtime_accounting_enabled() returns true. Then no delta is added.

> 
> > 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
> 
> It would have been helpful if you'd used a small script to take out the
> right column. As is I've no clue which field to look at.

Sorry for inconvenience with little explanation.
I watched /proc/<pid>/stats.
When guest running busy, gtime looks big number.

10987 (qemu-kvm) S ... 3554 ...
10987 (qemu-kvm) R ... 21415 ...

and keep it busy. after 1 second.

10987 (qemu-kvm) R ... 21616 ...

few second later, I stopped busy program on guest.
The gtime back to sane value.

10987 (qemu-kvm) S ... 4084 ...


thanks,
Hiroshi

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web