From mboxrd@z Thu Jan 1 00:00:00 1970 From: Glauber Costa Subject: Re: [RFC 5/8] change kernel accounting to include steal time Date: Mon, 30 Aug 2010 14:26:14 -0300 Message-ID: <20100830172614.GM17084@mothafucka.localdomain> References: <1283184391-7785-2-git-send-email-glommer@redhat.com> <1283184391-7785-3-git-send-email-glommer@redhat.com> <1283184391-7785-4-git-send-email-glommer@redhat.com> <1283184391-7785-5-git-send-email-glommer@redhat.com> <1283184391-7785-6-git-send-email-glommer@redhat.com> <1283184391-7785-7-git-send-email-glommer@redhat.com> <1283184391-7785-8-git-send-email-glommer@redhat.com> <1283184391-7785-9-git-send-email-glommer@redhat.com> <1283184391-7785-10-git-send-email-glommer@redhat.com> <1283186785.1820.1174.camel@laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com, zamsden@redhat.com, mtosatti@redhat.com, riel@redhat.com, mingo@elte.hu, jeremy@goop.org To: Peter Zijlstra Return-path: Received: from mx1.redhat.com ([209.132.183.28]:57489 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752833Ab0H3R0c (ORCPT ); Mon, 30 Aug 2010 13:26:32 -0400 Content-Disposition: inline In-Reply-To: <1283186785.1820.1174.camel@laptop> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Aug 30, 2010 at 06:46:25PM +0200, Peter Zijlstra wrote: > On Mon, 2010-08-30 at 12:06 -0400, Glauber Costa wrote: > > This patch proposes a common steal time implementation. When no > > steal time is accounted, we just add a branch to the current > > accounting code, that shouldn't add much overhead. > > But why not use alternative code and avoid that conditional > all-together? > > > * Account user cpu time to a process. > > * @p: the process that the cpu time gets accounted to > > @@ -3169,6 +3179,12 @@ void account_user_time(struct task_struct *p, cputime_t cputime, > > struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat; > > cputime64_t tmp; > > > > + tmp = get_steal_time_from_hypervisor(); > > + if (tmp) { > > + account_steal_time(tmp); > > + return; > > + } > > + > > /* Add user time to process. */ > > p->utime = cputime_add(p->utime, cputime); > > p->utimescaled = cputime_add(p->utimescaled, cputime_scaled); > > @@ -3234,6 +3250,12 @@ void account_system_time(struct task_struct *p, int hardirq_offset, > > return; > > } > > > > + tmp = get_steal_time_from_hypervisor(); > > + if (tmp) { > > + account_steal_time(tmp); > > + return; > > + } > > + > > /* Add system time to process. */ > > p->stime = cputime_add(p->stime, cputime); > > p->stimescaled = cputime_add(p->stimescaled, cputime_scaled); > > Why replicate that code and not restructure account_process_tick()? For both: because this way is easier, and this is just an rfc, so I am mainly interested in getting convergence on the design, or leaving this behind altogether. I do agree with both your comments, btw