From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC PATCH] KVM: x86: Skip request checking branches in vcpu_enter_guest() more effectively Date: Mon, 24 Sep 2012 16:53:09 +0200 Message-ID: <506073D5.7040307@redhat.com> References: <20120924152447.36c71b8f.yoshikawa_takuya_b1@lab.ntt.co.jp> <506004E0.4070103@linux.vnet.ibm.com> <5060313C.1060506@redhat.com> <20120924233250.ee28141b66d47b6c8bd39727@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Xiao Guangrong , Takuya Yoshikawa , mtosatti@redhat.com, kvm@vger.kernel.org To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:8931 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755765Ab2IXOxQ (ORCPT ); Mon, 24 Sep 2012 10:53:16 -0400 In-Reply-To: <20120924233250.ee28141b66d47b6c8bd39727@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/24/2012 04:32 PM, Takuya Yoshikawa wrote: > On Mon, 24 Sep 2012 12:09:00 +0200 > Avi Kivity wrote: > >> > while (vcpu->request) { >> > xchg(vcpu->request, request); >> > >> > for_each_set_bit(request) { >> > clear_bit(X); >> > >> > ...... >> > } >> > >> > } >> >> In fact I had something like that in one of the earlier versions, but it >> was problematic. I'll try to see what the issue was. > > Unless there are many requests, the cost of for_each_set_bit() and a few > added code may exceed that of the original code. > (Looping using __ffs() is an alternative because requests is "long".) > > So I wanted to know the most common requests pattern. See other branch of this thread. But in short, I now think you are right and the special-case is warranted. (not for STEAL_UPDATE - that's likely a bug, it should only happen on overcommit) -- error compiling committee.c: too many arguments to function