From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Jan Kara <jack@suse.cz>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
Christoph Hellwig <hch@lst.de>, Linux MM <linux-mm@kvack.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH 1/2] mm: improve readability of transparent_hugepage_enabled()
Date: Tue, 13 Jun 2017 15:34:01 -0600 [thread overview]
Message-ID: <20170613213401.GA17972@linux.intel.com> (raw)
In-Reply-To: <CAPcyv4jjx3QpAMgpRx0h+8bUkcKC0DhW-3Bds0T8K1Z8kgw=xA@mail.gmail.com>
On Tue, Jun 13, 2017 at 02:16:49PM -0700, Dan Williams wrote:
> On Tue, Jun 13, 2017 at 2:06 PM, Ross Zwisler
> <ross.zwisler@linux.intel.com> 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.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.cz>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
Linux MM <linux-mm@kvack.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Christoph Hellwig <hch@lst.de>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH 1/2] mm: improve readability of transparent_hugepage_enabled()
Date: Tue, 13 Jun 2017 15:34:01 -0600 [thread overview]
Message-ID: <20170613213401.GA17972@linux.intel.com> (raw)
In-Reply-To: <CAPcyv4jjx3QpAMgpRx0h+8bUkcKC0DhW-3Bds0T8K1Z8kgw=xA@mail.gmail.com>
On Tue, Jun 13, 2017 at 02:16:49PM -0700, Dan Williams wrote:
> On Tue, Jun 13, 2017 at 2:06 PM, Ross Zwisler
> <ross.zwisler@linux.intel.com> 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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-06-13 21:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-10 21:49 [PATCH 0/2] mm: force enable thp for dax Dan Williams
2017-06-10 21:49 ` Dan Williams
2017-06-10 21:49 ` [PATCH 1/2] mm: improve readability of transparent_hugepage_enabled() Dan Williams
2017-06-10 21:49 ` Dan Williams
2017-06-12 12:08 ` Kirill A. Shutemov
2017-06-12 12:08 ` Kirill A. Shutemov
2017-06-13 21:06 ` Ross Zwisler
2017-06-13 21:06 ` Ross Zwisler
2017-06-13 21:16 ` Dan Williams
2017-06-13 21:16 ` Dan Williams
2017-06-13 21:34 ` Ross Zwisler [this message]
2017-06-13 21:34 ` Ross Zwisler
2017-06-10 21:49 ` [PATCH 2/2] mm: always enable thp for dax mappings Dan Williams
2017-06-10 21:49 ` Dan Williams
2017-06-12 12:07 ` Kirill A. Shutemov
2017-06-12 12:07 ` Kirill A. Shutemov
2017-06-12 14:47 ` Dan Williams
2017-06-12 14:47 ` Dan Williams
2017-06-13 21:35 ` Ross Zwisler
2017-06-13 21:35 ` Ross Zwisler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170613213401.GA17972@linux.intel.com \
--to=ross.zwisler@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.