From: Rik van Riel <riel@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Wanpeng Li <wanpeng.li@hotmail.com>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Radim Krcmar <rkrcmar@redhat.com>, Mike Galbraith <efault@gmx.de>,
Frederic Weisbecker <fweisbec@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2] sched/cputime: Resync steal time when guest & host lose sync
Date: Tue, 16 Aug 2016 21:54:54 -0400 [thread overview]
Message-ID: <1471398894.32433.58.camel@redhat.com> (raw)
In-Reply-To: <1471396611-3347-1-git-send-email-wanpeng.li@hotmail.com>
[-- Attachment #1: Type: text/plain, Size: 1216 bytes --]
On Wed, 2016-08-17 at 09:16 +0800, Wanpeng Li wrote:
>
> @@ -694,6 +699,12 @@ static cputime_t get_vtime_delta(struct
> task_struct *tsk)
> unsigned long now = READ_ONCE(jiffies);
> cputime_t delta, other;
>
> + /*
> + * The interval returned by account_other_time() is NOT
> + * rounded down to the nearest jiffy, while the base
> + * interval it is subtracted from is. So the max cputime
> + * limit is required to avoid underflow.
> + */
> delta = jiffies_to_cputime(now - tsk->vtime_snap);
> other = account_other_time(delta);
> WARN_ON_ONCE(tsk->vtime_snap_whence == VTIME_INACTIVE);
That comment makes sense in the context of the discussion
we have been having over the past few days, but could be
somewhat cryptic to someone looking at it 3 years from now.
How about something like the following?
/*
* Unlike tick based timing, vtime based timing never has lost
* ticks, and no need for steal time accounting to make up for
* lost ticks. Vtime accounts a rounded version of actual
* elapsed time. Limit account_other_time to prevent rounding
* errors from causing elapsed vtime to go negative.
*/
--
All Rights Reversed.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-08-17 1:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-17 1:16 [PATCH v2] sched/cputime: Resync steal time when guest & host lose sync Wanpeng Li
2016-08-17 1:54 ` Rik van Riel [this message]
2016-08-17 2:05 ` Wanpeng Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1471398894.32433.58.camel@redhat.com \
--to=riel@redhat.com \
--cc=efault@gmx.de \
--cc=fweisbec@gmail.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=wanpeng.li@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox