Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754631AbbGGIGB (ORCPT ); Tue, 7 Jul 2015 04:06:01 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:33532 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752095AbbGGIFm (ORCPT ); Tue, 7 Jul 2015 04:05:42 -0400 MIME-Version: 1.0 In-Reply-To: <1436218475.2658.14.camel@freescale.com> References: <1433917639-31699-1-git-send-email-wenweitaowenwei@gmail.com> <1433917639-31699-7-git-send-email-wenweitaowenwei@gmail.com> <1435873760.10531.11.camel@freescale.com> <1436218475.2658.14.camel@freescale.com> Date: Tue, 7 Jul 2015 16:05:39 +0800 Message-ID: Subject: Re: [RFC PATCH 6/6] powerpc/kvm: change the condition of identifying hugetlb vm From: wenwei tao To: Scott Wood Cc: Izik Eidus , aarcange@redhat.com, chrisw@sous-sol.org, Hugh Dickins , tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, viro@zeniv.linux.org.uk, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1928 Lines: 58 Hi Scott I understand what you said. I will use the function 'is_vm_hugetlb_page()' to hide the bit combinations according to your comments in the next version of patch set. But for the situation like below, there isn't an obvious structure 'vma', using 'is_vm_hugetlb_page()' maybe costly or even not possible. void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, unsigned long end, unsigned long vmflag) { ... if (end == TLB_FLUSH_ALL || tlb_flushall_shift == -1 || vmflag & VM_HUGETLB) { local_flush_tlb(); goto flush_all; } ... } Thank you Wenwei 2015-07-07 5:34 GMT+08:00 Scott Wood : > On Fri, 2015-07-03 at 16:47 +0800, wenwei tao wrote: >> Hi Scott >> >> Thank you for your comments. >> >> Kernel already has that function: is_vm_hugetlb_page() , but the >> original code didn't use it, >> in order to keep the coding style of the original code, I didn't use it >> either. >> >> For the sentence like: "vma->vm_flags & VM_HUGETLB" , hiding it behind >> 'is_vm_hugetlb_page()' is ok, >> but the sentence like: "vma->vm_flags & >> (VM_LOCKED|VM_HUGETLB|VM_PFNMAP)" appears in the patch 2/6, >> is it better to hide the bit combinations behind the >> is_vm_hugetlb_page() ? In my patch I just replaced it with >> "vma->vm_flags & (VM_LOCKED|VM_PFNMAP) || (vma->vm_flags & >> (VM_HUGETLB|VM_MERGEABLE)) == VM_HUGETLB". > > If you're going to do non-obvious things with the flags, it should be done in > one place rather than throughout the code. Why would you do the above and > not "vma->vm_flags & (VM_LOCKED | VM_PFNMAP) || is_vm_hugetlb_page(vma)"? > > -Scott > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/