lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANRm+CzRAxp2G40ZdzdjUNUFMfOKo5BVxZ-xJzZ9L5oyy1ct2g@mail.gmail.com>
Date:	Thu, 9 Jun 2016 07:57:58 +0800
From:	Wanpeng Li <kernellwp@...il.com>
To:	Rik van Riel <riel@...hat.com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	kvm <kvm@...r.kernel.org>, Wanpeng Li <wanpeng.li@...mail.com>,
	Ingo Molnar <mingo@...nel.org>,
	"Peter Zijlstra (Intel)" <peterz@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Paolo Bonzini <pbonzini@...hat.com>,
	Radim Krčmář <rkrcmar@...hat.com>
Subject: Re: [PATCH v5 3/3] sched/cputime: Add steal time support to full
 dynticks CPU time accounting

2016-06-09 3:05 GMT+08:00 Rik van Riel <riel@...hat.com>:
> On Wed, 2016-06-08 at 11:05 +0800, Wanpeng Li wrote:
>>
>> @@ -681,12 +681,17 @@ static cputime_t vtime_delta(struct task_struct
>> *tsk)
>>  static cputime_t get_vtime_delta(struct task_struct *tsk)
>>  {
>>       unsigned long now = READ_ONCE(jiffies);
>> -     unsigned long delta = now - tsk->vtime_snap;
>> +     cputime_t delta_time, steal_time;
>>
>> +     steal_time =
>> jiffies_to_cputime(steal_account_process_tick());
>> +     delta_time = jiffies_to_cputime(now - tsk->vtime_snap);
>>       WARN_ON_ONCE(tsk->vtime_snap_whence == VTIME_INACTIVE);
>>       tsk->vtime_snap = now;
>>
>> -     return jiffies_to_cputime(delta);
>> +     if (steal_time < delta_time)
>> +             delta_time -= steal_time;
>> +
>> +     return delta_time;
>>  }
>
> This isn't right.
>
> If steal_time is equal to or larger than delta_time,
> get_vtime_delta needs to return 0, not delta_time.
>
> Otherwise the same time will be counted twice.

Paolo also pointed out this yesterday, so his proposal looks good to you, right?

Regards,
Wanpeng Li

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ