From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 0/8] KVM: Reduce mmu_lock hold time when zapping mmu pages Date: Wed, 23 Jan 2013 23:45:09 +0800 Message-ID: <51000585.1040603@gmail.com> References: <20130123191231.d66489d2.yoshikawa_takuya_b1@lab.ntt.co.jp> <50FFBF24.3000203@linux.vnet.ibm.com> <20130123222846.05bfc05a91ee133bd25981d6@gmail.com> <50FFE973.30709@linux.vnet.ibm.com> <20130123234905.a982e78b52160a8bdf3f35f1@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Xiao Guangrong , Takuya Yoshikawa , mtosatti@redhat.com, gleb@redhat.com, kvm@vger.kernel.org To: Takuya Yoshikawa Return-path: Received: from mail-da0-f49.google.com ([209.85.210.49]:37984 "EHLO mail-da0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751233Ab3AWPpe (ORCPT ); Wed, 23 Jan 2013 10:45:34 -0500 Received: by mail-da0-f49.google.com with SMTP id v40so3832898dad.22 for ; Wed, 23 Jan 2013 07:45:34 -0800 (PST) In-Reply-To: <20130123234905.a982e78b52160a8bdf3f35f1@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 01/23/2013 10:49 PM, Takuya Yoshikawa wrote: > On Wed, 23 Jan 2013 21:45:23 +0800 > Xiao Guangrong wrote: > >>> The current code which deletes the two link nodes in different functions >>> looks unnatural to me: traversing the sp->link nodes forces us to break >>> the loop and sp->hash_link nodes alone is allowed to continue ... >>> >>> Making each function semantically clear should be more important than >>> other things. >>> >> >> The reason the code like this is, we have lockless shadow page walker. > > But hash_link needs to be protected by mmu_lock anyway? The purpose that do not delete hlist is for continuously walking hash table entry. Deleting link is for reusing it on invalid list to save memory space. If you really like to continuously walk sh->link, we can introduce another list for invalid list using, but it is not worthwhile. To be honest, i do not care this, no one ask us to obey the rule that "all lists should have the same walking behaviour". ;). But comment for these code is always appreciated.