From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH -v4] KVM: x86: lapic: Clean up find_highest_vector() and count_vectors() Date: Wed, 12 Sep 2012 13:39:32 -0300 Message-ID: <20120912163932.GA24540@amt.cnet> References: <20120830104458.GA19997@redhat.com> <20120830213019.82a822da.yoshikawa.takuya@oss.ntt.co.jp> <20120830132131.GB21132@redhat.com> <20120831010956.000856ead3c6f96dbe2bec46@gmail.com> <20120830164923.GA22024@redhat.com> <20120905173031.59581bb9.yoshikawa.takuya@oss.ntt.co.jp> <20120905092649.GD10326@redhat.com> <20120905184026.9aeddbc1.yoshikawa.takuya@oss.ntt.co.jp> <20120905095126.GA10531@redhat.com> <20120905193001.99d06c26.yoshikawa.takuya@oss.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@redhat.com, mst@redhat.com, kvm@vger.kernel.org To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38250 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932251Ab2ILRFA (ORCPT ); Wed, 12 Sep 2012 13:05:00 -0400 Content-Disposition: inline In-Reply-To: <20120905193001.99d06c26.yoshikawa.takuya@oss.ntt.co.jp> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Sep 05, 2012 at 07:30:01PM +0900, Takuya Yoshikawa wrote: > find_highest_vector() and count_vectors(): > - Instead of using magic values, define and use proper macros. > > find_highest_vector(): > - Remove likely() which is there only for historical reasons and not > doing correct branch predictions anymore. Using such heuristics > to optimize this function is not worth it now. Let CPUs predict > things instead. > > - Stop checking word[0] separately. This was only needed for doing > likely() optimization. > > - Use for loop, not while, to iterate over the register array to make > the code clearer. > > Note that we actually confirmed that the likely() did wrong predictions > by inserting debug code. > > Signed-off-by: Takuya Yoshikawa > Cc: Michael S. Tsirkin Applied, thanks.