From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: nice value is ignored on cpu time accounting of a guest? Date: Tue, 20 Oct 2009 16:34:42 +0900 Message-ID: <4ADD6812.3050900@redhat.com> References: <5e93dcec0910190246s7402417flfaadef0ddaf992ba@mail.gmail.com> <4ADD48D7.4090004@redhat.com> <5e93dcec0910200006j48e05abei787dab3be560c204@mail.gmail.com> <4ADD6424.9030404@redhat.com> <5e93dcec0910200027g30104446naa9214a2f8beda9a@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Ryota Ozaki Return-path: Received: from mx1.redhat.com ([209.132.183.28]:56250 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753693AbZJTHen (ORCPT ); Tue, 20 Oct 2009 03:34:43 -0400 In-Reply-To: <5e93dcec0910200027g30104446naa9214a2f8beda9a@mail.gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 10/20/2009 04:27 PM, Ryota Ozaki wrote: > On Tue, Oct 20, 2009 at 4:17 PM, Avi Kivity wrote: > >> On 10/20/2009 04:06 PM, Ryota Ozaki wrote: >> >>>> Looks like we need to add a separate guest_nice, or get rid of guest time >>>> altogether. >>>> >>>> >>> Hmm, guest time is already exposed via /proc/stat so adding guest_nice is >>> better >>> if fix here? I don't know anyone utilize 'guest' value though. >>> >>> >> No one uses guest time to my knowledge. However, we can't be sure, so it's >> better to add guest_nice. >> >> Note you need to add guest_nice to user_nice, so old tools see it as nice >> time (same as guest_time now). >> > Well, like this? > > /* Add user time to cpustat. */ > tmp = cputime_to_cputime64(cputime); > if (TASK_NICE(p)> 0) { > cpustat->nice = cputime64_add(cpustat->nice, tmp); > cpustat->guest_nice = cputime64_add(cpustat->guest_nice, tmp); > } else { > cpustat->user = cputime64_add(cpustat->user, tmp); > cpustat->guest = cputime64_add(cpustat->guest, tmp); > } > In account_guest_time()? Yes. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.