From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932833AbbIDAP7 (ORCPT ); Thu, 3 Sep 2015 20:15:59 -0400 Received: from blu004-omc1s21.hotmail.com ([65.55.116.32]:52458 "EHLO BLU004-OMC1S21.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757454AbbIDAP6 (ORCPT ); Thu, 3 Sep 2015 20:15:58 -0400 X-TMN: [s+68Ch+1Zff309unieyWtEETLocNFqZj] X-Originating-Email: [wanpeng.li@hotmail.com] Message-ID: Subject: Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment To: David Matlack References: <1441178971-3836-1-git-send-email-wanpeng.li@hotmail.com> CC: Paolo Bonzini , kvm list , "linux-kernel@vger.kernel.org" From: Wanpeng Li Date: Fri, 4 Sep 2015 08:15:50 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 04 Sep 2015 00:15:56.0303 (UTC) FILETIME=[DE5841F0:01D0E6A6] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/4/15 12:07 AM, David Matlack wrote: > On Thu, Sep 3, 2015 at 2:23 AM, Wanpeng Li wrote: >> How about something like: >> >> @@ -1941,10 +1976,14 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) >> */ >> if (kvm_vcpu_check_block(vcpu) < 0) { >> ++vcpu->stat.halt_successful_poll; >> - goto out; >> + break; >> } >> cur = ktime_get(); >> } while (single_task_running() && ktime_before(cur, stop)); >> + >> + poll_ns = ktime_to_ns(cur) - ktime_to_ns(start); >> + if (ktime_before(cur, stop) && single_task_running()) >> + goto out; > I would prefer an explicit signal (e.g. set a bool to true before breaking out > of the loop, and check it here) to avoid duplicating the loop exit condition. Fix it in v7, thanks for your review, David! ;-) Regards, Wanpeng Li