From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753193AbbIFWXs (ORCPT ); Sun, 6 Sep 2015 18:23:48 -0400 Received: from blu004-omc1s4.hotmail.com ([65.55.116.15]:58686 "EHLO BLU004-OMC1S4.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751561AbbIFWXk (ORCPT ); Sun, 6 Sep 2015 18:23:40 -0400 X-TMN: [cieO1i5S8FtKOcZmQRfwhSd6vy52yOBb] X-Originating-Email: [wanpeng.li@hotmail.com] Message-ID: Subject: Re: [PATCH v7 2/3] KVM: dynamic halt-polling To: Paolo Bonzini References: <1441289259-32072-1-git-send-email-wanpeng.li@hotmail.com> <55EC4E63.8030504@redhat.com> CC: David Matlack , kvm@vger.kernel.org, linux-kernel@vger.kernel.org From: Wanpeng Li Date: Mon, 7 Sep 2015 06:23:35 +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: <55EC4E63.8030504@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 06 Sep 2015 22:23:38.0550 (UTC) FILETIME=[AD91FD60:01D0E8F2] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/6/15 10:32 PM, Paolo Bonzini wrote: > > On 05/09/2015 00:38, Wanpeng Li wrote: >>> @@ -1940,11 +1975,16 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) >>> * arrives. >>> */ >>> if (kvm_vcpu_check_block(vcpu) < 0) { >>> + polled = true; >>> ++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 (polled) >>> + goto out; >>> >> Please move poll_ns caculation under if() when you applied, as I >> explained in reply to v6. > You can do much more than just that, the patch reduces to this: > Cool, many thanks for your help, Paolo! :) Regards, Wanpeng Li