Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754844AbcCJSM6 (ORCPT ); Thu, 10 Mar 2016 13:12:58 -0500 Received: from mga01.intel.com ([192.55.52.88]:2457 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753173AbcCJSMz (ORCPT ); Thu, 10 Mar 2016 13:12:55 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,316,1455004800"; d="scan'208";a="63696486" Subject: Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page() To: Paolo Bonzini , Lan Tianyu , Thomas Gleixner References: <1457055312-27067-1-git-send-email-tianyu.lan@intel.com> <56D9354E.9040908@intel.com> <56D94BFE.1080406@redhat.com> <56DE8F1A.9000401@intel.com> <56DEEF69.20208@redhat.com> <56E1875E.8060007@linux.intel.com> <56E19224.9090906@redhat.com> <56E1933E.20909@redhat.com> <56E196AC.4030103@linux.intel.com> <56E19B21.8090501@redhat.com> Cc: gleb@kernel.org, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org From: Xiao Guangrong Message-ID: <56E1B5A2.8050002@linux.intel.com> Date: Fri, 11 Mar 2016 01:57:54 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56E19B21.8090501@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1170 Lines: 36 On 03/11/2016 12:04 AM, Paolo Bonzini wrote: > > > On 10/03/2016 16:45, Xiao Guangrong wrote: >>> >>>> Compared to smp_load_acquire(), smp_mb() adds an ordering between stores >>>> and loads. >>> >>> Here, the ordering is load-store, hence... >> >> Yes, this is why i put smp_mb() in the code. :) > > Here is a table of barriers: > > > '. after| | > before '. | load | store > __________'.|___________________|________________________ > | | > | smp_rmb | smp_load_acquire > load | smp_load_acquire | smp_store_release XX > | smp_mb | smp_mb > ____________|___________________|________________________ > | | > | | smp_wmb > store | smp_mb | smp_store_release > | | smp_mb > | | > > Your case is the one marked with XX, so a smp_load_acquire() is > enough---and it's preferrable, because it's cheaper than smp_mb() and > more self-documenting. Yes, you are right and thank you for pointing it out.