From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 13 Jun 2017 15:34:01 -0600 From: Ross Zwisler To: Dan Williams Cc: Ross Zwisler , Andrew Morton , Jan Kara , "linux-nvdimm@lists.01.org" , Linux MM , linux-fsdevel , Christoph Hellwig , "Kirill A. Shutemov" Subject: Re: [PATCH 1/2] mm: improve readability of transparent_hugepage_enabled() Message-ID: <20170613213401.GA17972@linux.intel.com> References: <149713136649.17377.3742583729924020371.stgit@dwillia2-desk3.amr.corp.intel.com> <149713137177.17377.6712234218256825718.stgit@dwillia2-desk3.amr.corp.intel.com> <20170613210630.GA5135@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: On Tue, Jun 13, 2017 at 02:16:49PM -0700, Dan Williams wrote: > On Tue, Jun 13, 2017 at 2:06 PM, Ross Zwisler > wrote: > > So, if the VM_NOHUGEPAGE flag is set or if the vma is for a temporary stack, > > we always bail. Also, we only care about the VM_HUGEPAGE flag in the presence > > of TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG. > > > > I think this static inline is logically equivalent (untested): > > > > static inline bool transparent_hugepage_enabled(struct vm_area_struct *vma) > > { > > if ((vma->vm_flags & VM_NOHUGEPAGE) || is_vma_temporary_stack(vma)) > > return false; > > > > if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_FLAG)) > > return true; > > > > if ((transparent_hugepage_flags & > > (1 << TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG)) > > && vma->vm_flags & VM_HUGEPAGE) > > return true; > > We can clean this up a bit and do: > > return !!(vma->vm_flags & VM_HUGEPAGE) > > ...to drop the && Sure, that'll read better. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org