On 05/13/2013 07:24 PM, Gleb Natapov wrote: > On Fri, May 10, 2013 at 09:43:50AM +0800, Xiao Guangrong wrote: >> On 05/10/2013 09:05 AM, Takuya Yoshikawa wrote: >>> On Thu, 09 May 2013 18:11:31 +0800 >>> Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxxxxxx> wrote: >>> >>>> On 05/09/2013 02:46 PM, Takuya Yoshikawa wrote: >>>>> By making the last three statements common to both if/else cases, the >>>>> symmetry between the locking and unlocking becomes clearer. One note >>>>> here is that VCPU's root_hpa does not need to be protected by mmu_lock. >>>>> >>>>> Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@xxxxxxxxxxxxx> >>>>> --- >>>>> arch/x86/kvm/mmu.c | 39 +++++++++++++++++++-------------------- >>>>> 1 files changed, 19 insertions(+), 20 deletions(-) >>>> >>>> DO NOT think it makes any thing better. >>>> >>> >>> Why do we need to do the same thing differently in two paths? >> >> They are different cases, one is the long mode, anther is PAE mode, >> return from one case and continue to handle the anther case is common >> used, and it can reduce the indentation and easily follow the code. >> > I agree that this is mostly code style issue and with Takuya patch the > indentation is dipper. Also the structure of mmu_free_roots() resembles > mmu_alloc_shadow_roots() currently. The latter has the same if(){return} > pattern. I also agree with Takuya that locking symmetry can be improved. > What about something like this (untested): It is good to me! ;) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html