From: Michal Hocko <mhocko@kernel.org>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Matthew Wilcox <willy@infradead.org>,
akpm@linux-foundation.org, ak@linux.intel.com,
mtk.manpages@gmail.com, Davidlohr Bueso <dbueso@suse.de>,
khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com,
aarcange@redhat.com
Subject: Re: [RFC PATCH 2/3] mm: arch: Use new hugetlb size encoding definitions
Date: Wed, 26 Jul 2017 11:52:27 +0200 [thread overview]
Message-ID: <20170726095227.GE2981@dhcp22.suse.cz> (raw)
In-Reply-To: <1500330481-28476-3-git-send-email-mike.kravetz@oracle.com>
On Mon 17-07-17 15:28:00, Mike Kravetz wrote:
> Use the common definitions from hugetlb_encode.h header file for
> encoding hugetlb size definitions in mmap system call flags.
>
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
with s@HUGETLB_FLAG_ENCODE__16GB@HUGETLB_FLAG_ENCODE_16GB@
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> arch/alpha/include/uapi/asm/mman.h | 14 ++++++--------
> arch/mips/include/uapi/asm/mman.h | 14 ++++++--------
> arch/parisc/include/uapi/asm/mman.h | 14 ++++++--------
> arch/powerpc/include/uapi/asm/mman.h | 23 ++++++++++-------------
> arch/x86/include/uapi/asm/mman.h | 10 ++++++++--
> arch/xtensa/include/uapi/asm/mman.h | 14 ++++++--------
> include/uapi/asm-generic/mman-common.h | 6 ++++--
> 7 files changed, 46 insertions(+), 49 deletions(-)
>
> diff --git a/arch/alpha/include/uapi/asm/mman.h b/arch/alpha/include/uapi/asm/mman.h
> index 02760f6..bfa5828 100644
> --- a/arch/alpha/include/uapi/asm/mman.h
> +++ b/arch/alpha/include/uapi/asm/mman.h
> @@ -1,6 +1,8 @@
> #ifndef __ALPHA_MMAN_H__
> #define __ALPHA_MMAN_H__
>
> +#include <asm-generic/hugetlb_encode.h>
> +
> #define PROT_READ 0x1 /* page can be read */
> #define PROT_WRITE 0x2 /* page can be written */
> #define PROT_EXEC 0x4 /* page can be executed */
> @@ -68,15 +70,11 @@
> #define MAP_FILE 0
>
> /*
> - * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
> - * This gives us 6 bits, which is enough until someone invents 128 bit address
> - * spaces.
> - *
> - * Assume these are all power of twos.
> - * When 0 use the default page size.
> + * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
> + * size other than the default is desired. See hugetlb_encode.h
> */
> -#define MAP_HUGE_SHIFT 26
> -#define MAP_HUGE_MASK 0x3f
> +#define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
> +#define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
>
> #define PKEY_DISABLE_ACCESS 0x1
> #define PKEY_DISABLE_WRITE 0x2
> diff --git a/arch/mips/include/uapi/asm/mman.h b/arch/mips/include/uapi/asm/mman.h
> index 655e2fb..9e55284 100644
> --- a/arch/mips/include/uapi/asm/mman.h
> +++ b/arch/mips/include/uapi/asm/mman.h
> @@ -8,6 +8,8 @@
> #ifndef _ASM_MMAN_H
> #define _ASM_MMAN_H
>
> +#include <asm-generic/hugetlb_encode.h>
> +
> /*
> * Protections are chosen from these bits, OR'd together. The
> * implementation does not necessarily support PROT_EXEC or PROT_WRITE
> @@ -95,15 +97,11 @@
> #define MAP_FILE 0
>
> /*
> - * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
> - * This gives us 6 bits, which is enough until someone invents 128 bit address
> - * spaces.
> - *
> - * Assume these are all power of twos.
> - * When 0 use the default page size.
> + * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
> + * size other than the default is desired. See hugetlb_encode.h
> */
> -#define MAP_HUGE_SHIFT 26
> -#define MAP_HUGE_MASK 0x3f
> +#define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
> +#define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
>
> #define PKEY_DISABLE_ACCESS 0x1
> #define PKEY_DISABLE_WRITE 0x2
> diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h
> index 5979745..11c6d86 100644
> --- a/arch/parisc/include/uapi/asm/mman.h
> +++ b/arch/parisc/include/uapi/asm/mman.h
> @@ -1,6 +1,8 @@
> #ifndef __PARISC_MMAN_H__
> #define __PARISC_MMAN_H__
>
> +#include <asm-generic/hugetlb_encode.h>
> +
> #define PROT_READ 0x1 /* page can be read */
> #define PROT_WRITE 0x2 /* page can be written */
> #define PROT_EXEC 0x4 /* page can be executed */
> @@ -65,15 +67,11 @@
> #define MAP_VARIABLE 0
>
> /*
> - * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
> - * This gives us 6 bits, which is enough until someone invents 128 bit address
> - * spaces.
> - *
> - * Assume these are all power of twos.
> - * When 0 use the default page size.
> + * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
> + * size other than the default is desired. See hugetlb_encode.h
> */
> -#define MAP_HUGE_SHIFT 26
> -#define MAP_HUGE_MASK 0x3f
> +#define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
> +#define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
>
> #define PKEY_DISABLE_ACCESS 0x1
> #define PKEY_DISABLE_WRITE 0x2
> diff --git a/arch/powerpc/include/uapi/asm/mman.h b/arch/powerpc/include/uapi/asm/mman.h
> index ab45cc2..80fd56c 100644
> --- a/arch/powerpc/include/uapi/asm/mman.h
> +++ b/arch/powerpc/include/uapi/asm/mman.h
> @@ -8,6 +8,7 @@
> #define _UAPI_ASM_POWERPC_MMAN_H
>
> #include <asm-generic/mman-common.h>
> +#include <asm-generic/hugetlb_encode.h>
>
>
> #define PROT_SAO 0x10 /* Strong Access Ordering */
> @@ -30,19 +31,15 @@
> #define MAP_HUGETLB 0x40000 /* create a huge page mapping */
>
> /*
> - * When MAP_HUGETLB is set, bits [26:31] of the flags argument to mmap(2),
> - * encode the log2 of the huge page size. A value of zero indicates that the
> - * default huge page size should be used. To use a non-default huge page size,
> - * one of these defines can be used, or the size can be encoded by hand. Note
> - * that on most systems only a subset, or possibly none, of these sizes will be
> - * available.
> + * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
> + * size other than the default is desired. See hugetlb_encode.h
> */
> -#define MAP_HUGE_512KB (19 << MAP_HUGE_SHIFT) /* 512KB HugeTLB Page */
> -#define MAP_HUGE_1MB (20 << MAP_HUGE_SHIFT) /* 1MB HugeTLB Page */
> -#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT) /* 2MB HugeTLB Page */
> -#define MAP_HUGE_8MB (23 << MAP_HUGE_SHIFT) /* 8MB HugeTLB Page */
> -#define MAP_HUGE_16MB (24 << MAP_HUGE_SHIFT) /* 16MB HugeTLB Page */
> -#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT) /* 1GB HugeTLB Page */
> -#define MAP_HUGE_16GB (34 << MAP_HUGE_SHIFT) /* 16GB HugeTLB Page */
> +#define MAP_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB /* 512KB HugeTLB Page */
> +#define MAP_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB /* 1MB HugeTLB Page */
> +#define MAP_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB /* 2MB HugeTLB Page */
> +#define MAP_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB /* 8MB HugeTLB Page */
> +#define MAP_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB /* 16MB HugeTLB Page */
> +#define MAP_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB /* 1GB HugeTLB Page */
> +#define MAP_HUGE_16GB HUGETLB_FLAG_ENCODE__16GB /* 16GB HugeTLB Page */
>
> #endif /* _UAPI_ASM_POWERPC_MMAN_H */
> diff --git a/arch/x86/include/uapi/asm/mman.h b/arch/x86/include/uapi/asm/mman.h
> index 39bca7f..5a67293 100644
> --- a/arch/x86/include/uapi/asm/mman.h
> +++ b/arch/x86/include/uapi/asm/mman.h
> @@ -1,10 +1,16 @@
> #ifndef _ASM_X86_MMAN_H
> #define _ASM_X86_MMAN_H
>
> +#include <asm-generic/hugetlb_encode.h>
> +
> #define MAP_32BIT 0x40 /* only give out 32bit addresses */
>
> -#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT)
> -#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT)
> +/*
> + * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
> + * size other than the default is desired. See hugetlb_encode.h
> + */
> +#define MAP_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB
> +#define MAP_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB
>
> #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
> /*
> diff --git a/arch/xtensa/include/uapi/asm/mman.h b/arch/xtensa/include/uapi/asm/mman.h
> index 24365b3..5deb5e4 100644
> --- a/arch/xtensa/include/uapi/asm/mman.h
> +++ b/arch/xtensa/include/uapi/asm/mman.h
> @@ -14,6 +14,8 @@
> #ifndef _XTENSA_MMAN_H
> #define _XTENSA_MMAN_H
>
> +#include <asm-generic/hugetlb_encode.h>
> +
> /*
> * Protections are chosen from these bits, OR'd together. The
> * implementation does not necessarily support PROT_EXEC or PROT_WRITE
> @@ -107,15 +109,11 @@
> #define MAP_FILE 0
>
> /*
> - * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
> - * This gives us 6 bits, which is enough until someone invents 128 bit address
> - * spaces.
> - *
> - * Assume these are all power of twos.
> - * When 0 use the default page size.
> + * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
> + * size other than the default is desired. See hugetlb_encode.h
> */
> -#define MAP_HUGE_SHIFT 26
> -#define MAP_HUGE_MASK 0x3f
> +#define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
> +#define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
>
> #define PKEY_DISABLE_ACCESS 0x1
> #define PKEY_DISABLE_WRITE 0x2
> diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h
> index 8c27db0..00d56b8 100644
> --- a/include/uapi/asm-generic/mman-common.h
> +++ b/include/uapi/asm-generic/mman-common.h
> @@ -1,6 +1,8 @@
> #ifndef __ASM_GENERIC_MMAN_COMMON_H
> #define __ASM_GENERIC_MMAN_COMMON_H
>
> +#include <asm-generic/hugetlb_encode.h>
> +
> /*
> Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
> Based on: asm-xxx/mman.h
> @@ -69,8 +71,8 @@
> * Assume these are all power of twos.
> * When 0 use the default page size.
> */
> -#define MAP_HUGE_SHIFT 26
> -#define MAP_HUGE_MASK 0x3f
> +#define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
> +#define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
>
> #define PKEY_DISABLE_ACCESS 0x1
> #define PKEY_DISABLE_WRITE 0x2
> --
> 2.7.5
>
> --
> 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-07-26 9:52 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-08 17:06 [PATCH] mm,hugetlb: compute page_size_log properly Davidlohr Bueso
2017-03-08 19:39 ` Andi Kleen
2017-03-09 3:24 ` Anshuman Khandual
2017-03-09 8:55 ` Michal Hocko
2017-03-28 16:53 ` Davidlohr Bueso
2017-03-28 16:55 ` Davidlohr Bueso
2017-03-28 17:54 ` Matthew Wilcox
2017-03-29 8:06 ` Michal Hocko
2017-03-29 17:45 ` Andi Kleen
2017-03-30 6:12 ` Michal Hocko
2017-04-12 16:18 ` Davidlohr Bueso
2017-04-12 16:30 ` Andi Kleen
2017-04-12 17:21 ` Matthew Wilcox
2017-04-13 6:02 ` Aneesh Kumar K.V
2017-04-13 12:46 ` Matthew Wilcox
2017-07-17 22:27 ` Mike Kravetz
2017-07-17 22:27 ` [RFC PATCH 1/3] mm:hugetlb: Define system call hugetlb size encodings in single file Mike Kravetz
2017-07-18 0:00 ` Matthew Wilcox
2017-07-26 9:50 ` Michal Hocko
2017-07-17 22:28 ` [RFC PATCH 2/3] mm: arch: Use new hugetlb size encoding definitions Mike Kravetz
2017-07-26 9:52 ` Michal Hocko [this message]
2017-07-17 22:28 ` [RFC PATCH 3/3] mm: shm: " Mike Kravetz
2017-07-26 9:53 ` Michal Hocko
2017-07-26 10:07 ` Michal Hocko
2017-07-26 17:39 ` Mike Kravetz
2017-07-26 18:48 ` Matthew Wilcox
2017-07-27 7:50 ` Michal Hocko
2017-07-27 21:18 ` Mike Kravetz
2017-07-28 6:30 ` Michal Hocko
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=20170726095227.GE2981@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=aarcange@redhat.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=dbueso@suse.de \
--cc=khandual@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=mtk.manpages@gmail.com \
--cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox