Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1689539 > unrolled thread

[RFC PATCH 1/3] mm:hugetlb: Define system call hugetlb size encodings in single file

Started byMike Kravetz <mike.kravetz@oracle.com>
First post2017-07-18 00:40 +0200
Last post2017-07-26 12:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC PATCH 1/3] mm:hugetlb:  Define system call hugetlb size encodings in single file Mike Kravetz <mike.kravetz@oracle.com> - 2017-07-18 00:40 +0200
    Re: [RFC PATCH 1/3] mm:hugetlb:  Define system call hugetlb size  encodings in single file Matthew Wilcox <willy@infradead.org> - 2017-07-18 02:10 +0200
    Re: [RFC PATCH 1/3] mm:hugetlb:  Define system call hugetlb size  encodings in single file Michal Hocko <mhocko@kernel.org> - 2017-07-26 12:00 +0200

#1689539 — [RFC PATCH 1/3] mm:hugetlb: Define system call hugetlb size encodings in single file

FromMike Kravetz <mike.kravetz@oracle.com>
Date2017-07-18 00:40 +0200
Subject[RFC PATCH 1/3] mm:hugetlb: Define system call hugetlb size encodings in single file
Message-ID<u4mQh-2yQ-5@gated-at.bofh.it>
If hugetlb pages are requested in mmap or shmget system calls,  a huge
page size other than default can be requested.  This is accomplished by
encoding the log2 of the huge page size in the upper bits of the flag
argument.  asm-generic and arch specific headers all define the same
values for these encodings.

Put common definitions in a single header file.  arch specific code can
still override if desired.

Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
---
 include/uapi/asm-generic/hugetlb_encode.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 include/uapi/asm-generic/hugetlb_encode.h

diff --git a/include/uapi/asm-generic/hugetlb_encode.h b/include/uapi/asm-generic/hugetlb_encode.h
new file mode 100644
index 0000000..aa09fc0
--- /dev/null
+++ b/include/uapi/asm-generic/hugetlb_encode.h
@@ -0,0 +1,30 @@
+#ifndef _ASM_GENERIC_HUGETLB_ENCODE_H_
+#define _ASM_GENERIC_HUGETLB_ENCODE_H_
+
+/*
+ * Several system calls take a flag to request "hugetlb" huge pages.
+ * Without further specification, these system calls will use the
+ * system's default huge page size.  If a system supports multiple
+ * huge page sizes, the desired huge page size can be specified in
+ * bits [26:31] of the flag arguments.  The value in these 6 bits
+ * will encode the log2 of the huge page size.
+ *
+ * The following definitions are associated with this huge page size
+ * encoding in flag arguments.  System call specific header files
+ * that use this encoding should include this file.  They can then
+ * provide definitions based on these with their own specific prefix.
+ * for example #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT.
+ */
+
+#define HUGETLB_FLAG_ENCODE_SHIFT	26
+#define HUGETLB_FLAG_ENCODE_MASK	0x3f
+
+#define HUGETLB_FLAG_ENCODE_512KB	(19 << MAP_HUGE_SHIFT
+#define HUGETLB_FLAG_ENCODE_1MB		(20 << MAP_HUGE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_2MB		(21 << MAP_HUGE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_8MB		(23 << MAP_HUGE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_16MB	(24 << MAP_HUGE_SHIFT)
+#define HUGETLB_FLAG_ENCODE_1GB		(30 << MAP_HUGE_SHIFT)
+#define HUGETLB_FLAG_ENCODE__16GB	(34 << MAP_HUGE_SHIFT)
+
+#endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */
-- 
2.7.5

[toc] | [next] | [standalone]


#1689570 — Re: [RFC PATCH 1/3] mm:hugetlb: Define system call hugetlb size encodings in single file

FromMatthew Wilcox <willy@infradead.org>
Date2017-07-18 02:10 +0200
SubjectRe: [RFC PATCH 1/3] mm:hugetlb: Define system call hugetlb size encodings in single file
Message-ID<u4ofo-3xU-19@gated-at.bofh.it>
In reply to#1689539
On Mon, Jul 17, 2017 at 03:27:59PM -0700, Mike Kravetz wrote:
> +#define HUGETLB_FLAG_ENCODE_512KB	(19 << MAP_HUGE_SHIFT
> +#define HUGETLB_FLAG_ENCODE_1MB		(20 << MAP_HUGE_SHIFT)
> +#define HUGETLB_FLAG_ENCODE_2MB		(21 << MAP_HUGE_SHIFT)
> +#define HUGETLB_FLAG_ENCODE_8MB		(23 << MAP_HUGE_SHIFT)
> +#define HUGETLB_FLAG_ENCODE_16MB	(24 << MAP_HUGE_SHIFT)
> +#define HUGETLB_FLAG_ENCODE_1GB		(30 << MAP_HUGE_SHIFT)
> +#define HUGETLB_FLAG_ENCODE__16GB	(34 << MAP_HUGE_SHIFT)

The __ seems like a mistake?

[toc] | [prev] | [next] | [standalone]


#1696946 — Re: [RFC PATCH 1/3] mm:hugetlb: Define system call hugetlb size encodings in single file

FromMichal Hocko <mhocko@kernel.org>
Date2017-07-26 12:00 +0200
SubjectRe: [RFC PATCH 1/3] mm:hugetlb: Define system call hugetlb size encodings in single file
Message-ID<u7rgL-77f-29@gated-at.bofh.it>
In reply to#1689539
On Mon 17-07-17 15:27:59, Mike Kravetz wrote:
> If hugetlb pages are requested in mmap or shmget system calls,  a huge
> page size other than default can be requested.  This is accomplished by
> encoding the log2 of the huge page size in the upper bits of the flag
> argument.  asm-generic and arch specific headers all define the same
> values for these encodings.
> 
> Put common definitions in a single header file.  arch specific code can
> still override if desired.
> 
> 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>

> ---
>  include/uapi/asm-generic/hugetlb_encode.h | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>  create mode 100644 include/uapi/asm-generic/hugetlb_encode.h
> 
> diff --git a/include/uapi/asm-generic/hugetlb_encode.h b/include/uapi/asm-generic/hugetlb_encode.h
> new file mode 100644
> index 0000000..aa09fc0
> --- /dev/null
> +++ b/include/uapi/asm-generic/hugetlb_encode.h
> @@ -0,0 +1,30 @@
> +#ifndef _ASM_GENERIC_HUGETLB_ENCODE_H_
> +#define _ASM_GENERIC_HUGETLB_ENCODE_H_
> +
> +/*
> + * Several system calls take a flag to request "hugetlb" huge pages.
> + * Without further specification, these system calls will use the
> + * system's default huge page size.  If a system supports multiple
> + * huge page sizes, the desired huge page size can be specified in
> + * bits [26:31] of the flag arguments.  The value in these 6 bits
> + * will encode the log2 of the huge page size.
> + *
> + * The following definitions are associated with this huge page size
> + * encoding in flag arguments.  System call specific header files
> + * that use this encoding should include this file.  They can then
> + * provide definitions based on these with their own specific prefix.
> + * for example #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT.
> + */
> +
> +#define HUGETLB_FLAG_ENCODE_SHIFT	26
> +#define HUGETLB_FLAG_ENCODE_MASK	0x3f
> +
> +#define HUGETLB_FLAG_ENCODE_512KB	(19 << MAP_HUGE_SHIFT
> +#define HUGETLB_FLAG_ENCODE_1MB		(20 << MAP_HUGE_SHIFT)
> +#define HUGETLB_FLAG_ENCODE_2MB		(21 << MAP_HUGE_SHIFT)
> +#define HUGETLB_FLAG_ENCODE_8MB		(23 << MAP_HUGE_SHIFT)
> +#define HUGETLB_FLAG_ENCODE_16MB	(24 << MAP_HUGE_SHIFT)
> +#define HUGETLB_FLAG_ENCODE_1GB		(30 << MAP_HUGE_SHIFT)
> +#define HUGETLB_FLAG_ENCODE__16GB	(34 << MAP_HUGE_SHIFT)
> +
> +#endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */
> -- 
> 2.7.5
> 

-- 
Michal Hocko
SUSE Labs

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web