From: Michal Hocko <mhocko@kernel.org>
To: Dan Williams <dan.j.williams@intel.com>
Cc: akpm@linux-foundation.org, Jan Kara <jack@suse.cz>,
linux-nvdimm@lists.01.org, linux-mm@kvack.org,
linux-fsdevel@vger.kernel.org,
Ross Zwisler <ross.zwisler@linux.intel.com>,
hch@lst.de,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH v2 1/2] mm: improve readability of transparent_hugepage_enabled()
Date: Wed, 14 Jun 2017 14:45:20 +0200 [thread overview]
Message-ID: <20170614124520.GA8537@dhcp22.suse.cz> (raw)
In-Reply-To: <149739530612.20686.14760671150202647861.stgit@dwillia2-desk3.amr.corp.intel.com>
On Tue 13-06-17 16:08:26, Dan Williams wrote:
> Turn the macro into a static inline and rewrite the condition checks for
> better readability in preparation for adding another condition.
>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> [ross: fix logic to make conversion equivalent]
> Acked-by: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This is really a nice deobfuscation! Please note this will conflict with
http://lkml.kernel.org/r/1496415802-30944-1-git-send-email-rppt@linux.vnet.ibm.com
Trivial to resolve but I thought I should give you a heads up.
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> include/linux/huge_mm.h | 32 +++++++++++++++++++++-----------
> 1 file changed, 21 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> index a3762d49ba39..c8119e856eb1 100644
> --- a/include/linux/huge_mm.h
> +++ b/include/linux/huge_mm.h
> @@ -85,14 +85,23 @@ extern struct kobj_attribute shmem_enabled_attr;
>
> extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
>
> -#define transparent_hugepage_enabled(__vma) \
> - ((transparent_hugepage_flags & \
> - (1<<TRANSPARENT_HUGEPAGE_FLAG) || \
> - (transparent_hugepage_flags & \
> - (1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG) && \
> - ((__vma)->vm_flags & VM_HUGEPAGE))) && \
> - !((__vma)->vm_flags & VM_NOHUGEPAGE) && \
> - !is_vma_temporary_stack(__vma))
> +extern unsigned long transparent_hugepage_flags;
> +
> +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))
> + return !!(vma->vm_flags & VM_HUGEPAGE);
> +
> + return false;
> +}
> +
> #define transparent_hugepage_use_zero_page() \
> (transparent_hugepage_flags & \
> (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG))
> @@ -104,8 +113,6 @@ extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
> #define transparent_hugepage_debug_cow() 0
> #endif /* CONFIG_DEBUG_VM */
>
> -extern unsigned long transparent_hugepage_flags;
> -
> extern unsigned long thp_get_unmapped_area(struct file *filp,
> unsigned long addr, unsigned long len, unsigned long pgoff,
> unsigned long flags);
> @@ -223,7 +230,10 @@ void mm_put_huge_zero_page(struct mm_struct *mm);
>
> #define hpage_nr_pages(x) 1
>
> -#define transparent_hugepage_enabled(__vma) 0
> +static inline bool transparent_hugepage_enabled(struct vm_area_struct *vma)
> +{
> + return false;
> +}
>
> static inline void prep_transhuge_page(struct page *page) {}
>
>
> --
> 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>
--
Michal Hocko
SUSE Labs
--
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-14 12:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-13 23:08 [PATCH v2 0/2] mm: force enable thp for dax Dan Williams
2017-06-13 23:08 ` [PATCH v2 1/2] mm: improve readability of transparent_hugepage_enabled() Dan Williams
2017-06-14 10:00 ` Jan Kara
2017-06-14 12:45 ` Michal Hocko [this message]
2017-06-14 19:26 ` Dan Williams
2017-06-15 8:07 ` Michal Hocko
2017-06-15 20:06 ` Andrew Morton
2017-06-15 22:23 ` Michal Hocko
2017-06-15 20:21 ` Dan Williams
2017-06-15 22:22 ` Michal Hocko
2017-06-15 23:44 ` Dan Williams
2017-06-14 16:53 ` Vlastimil Babka
2017-06-14 17:02 ` Dan Williams
2017-06-14 17:11 ` Vlastimil Babka
2017-06-13 23:08 ` [PATCH v2 2/2] mm: always enable thp for dax mappings Dan Williams
2017-06-14 10:05 ` Jan Kara
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=20170614124520.GA8537@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--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 \
--cc=ross.zwisler@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).