From: Christian Borntraeger Subject: Re: [PATCH v2] kvm: Fix accounting of interrupts during guest execution on s390 Date: Thu, 15 Nov 2007 19:05:05 +0100 Message-ID: <200711151905.05647.borntraeger@de.ibm.com> References: <200711141632.37004.borntraeger@de.ibm.com> <200711151656.44935.borntraeger@de.ibm.com> <1195146486.4704.60.camel@frecb07144> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel , Avi Kivity To: Laurent Vivier Return-path: In-Reply-To: <1195146486.4704.60.camel@frecb07144> Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Am Donnerstag, 15. November 2007 schrieb Laurent Vivier: > To be annoying, it should be clearer to write this like: > > if ( (p->flags & PF_VCPU) && > !(hardirq_count() - hardirq_offset) && > !softirq_count() ) > { > account_guest_time(p, cputime); > return; > } [...] > But I agree with your patch. > > Laurent Yes, that would have the same result. I think its a matter of taste, if we want to have a not-so-obvious one line if, or a multi-line-if. I dont mind which version use, here is your variant as an alternative: Ingo, you decide :-) From: Christian Borntraeger From: Laurent Vivier Signed-off-by: Christian Borntraeger --- kernel/sched.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: kvm/kernel/sched.c =================================================================== --- kvm.orig/kernel/sched.c +++ kvm/kernel/sched.c @@ -3395,7 +3395,9 @@ void account_system_time(struct task_str struct rq *rq = this_rq(); cputime64_t tmp; - if (p->flags & PF_VCPU) { + if ( (p->flags & PF_VCPU) && + !(hardirq_count() - hardirq_offset) && + !softirq_count() ) { account_guest_time(p, cputime); return; } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/