From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ulrich Drepper Subject: Re: [PATCH 2/2] kvm: change the dirty page tracking to work with dirty bity Date: Thu, 11 Jun 2009 01:24:47 -0700 Message-ID: <4A30BF4F.70406@redhat.com> References: <1244651005-18322-1-git-send-email-ieidus@redhat.com> <1244651005-18322-2-git-send-email-ieidus@redhat.com> <1244651005-18322-3-git-send-email-ieidus@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, avi@redhat.com To: Izik Eidus Return-path: Received: from mx2.redhat.com ([66.187.237.31]:55700 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751918AbZFKIYs (ORCPT ); Thu, 11 Jun 2009 04:24:48 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5B8Oosw007616 for ; Thu, 11 Jun 2009 04:24:50 -0400 In-Reply-To: <1244651005-18322-3-git-send-email-ieidus@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Izik Eidus wrote: > + if (!kvm_x86_ops->dirty_bit_support()) { > + spin_lock(&kvm->mmu_lock); > + /* remove_write_access() flush the tlb */ > + kvm_mmu_slot_remove_write_access(kvm, log->slot); > + spin_unlock(&kvm->mmu_lock); > + } else { > + kvm_flush_remote_tlbs(kvm); It might not correspond to the common style, but I think a callback function ->dirty_bit_support is overkill. This is a function pointer the compiler cannot see through. Hence it's an indirect function call. But the implementation is always a simple yes/no (it seems). Indirect calls are rather expensive (most of the time they cannot be predicted right). Why not instead have a read-only data constants and have an inline function test that value? It means no function call and only one data access. Also, you're inconsistent in the use of integers and true/false in the implementations of this function. Either use 0/1 or false/true. - -- =E2=9E=A7 Ulrich Drepper =E2=9E=A7 Red Hat, Inc. =E2=9E=A7 444 Castro S= t =E2=9E=A7 Mountain View, CA =E2=9D=96 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkowv08ACgkQ2ijCOnn/RHR71ACdH3xr3XPnCLgsMMwdTawfehEN vs4An2DlErhU6SeanSYVIyP3eLB4sjsz =3DUZ32 -----END PGP SIGNATURE-----