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


Groups > linux.kernel > #1464286

Re: [PATCH v2] sched/cputime: Resync steal time when guest & host lose sync

From Wanpeng Li <kernellwp@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] sched/cputime: Resync steal time when guest & host lose sync
Date 2016-08-17 04:20 +0200
Message-ID <s6YCt-34T-1@gated-at.bofh.it> (permalink)
References <s6XGp-2nq-3@gated-at.bofh.it> <s6Yj7-2C8-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


2016-08-17 9:54 GMT+08:00 Rik van Riel <riel@redhat.com>:
> 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.
>          */

Great, thanks for your help. I will send out a new version soon. :)

Regards,
Wanpeng Li

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2] sched/cputime: Resync steal time when guest & host lose sync Wanpeng Li <kernellwp@gmail.com> - 2016-08-17 03:20 +0200
  Re: [PATCH v2] sched/cputime: Resync steal time when guest & host  lose sync Rik van Riel <riel@redhat.com> - 2016-08-17 04:00 +0200
    Re: [PATCH v2] sched/cputime: Resync steal time when guest & host  lose sync Wanpeng Li <kernellwp@gmail.com> - 2016-08-17 04:20 +0200

csiph-web