From: Mike Kravetz <mike.kravetz@oracle.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Matthew Wilcox <willy@infradead.org>,
akpm@linux-foundation.org, mhocko@suse.com, 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, Mike Kravetz <mike.kravetz@oracle.com>
Subject: [RFC PATCH 1/3] mm:hugetlb: Define system call hugetlb size encodings in single file
Date: Mon, 17 Jul 2017 15:27:59 -0700 [thread overview]
Message-ID: <1500330481-28476-2-git-send-email-mike.kravetz@oracle.com> (raw)
In-Reply-To: <1500330481-28476-1-git-send-email-mike.kravetz@oracle.com>
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
next prev parent reply other threads:[~2017-07-17 22:29 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 ` Mike Kravetz [this message]
2017-07-18 0:00 ` [RFC PATCH 1/3] mm:hugetlb: Define system call hugetlb size encodings in single file 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
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=1500330481-28476-2-git-send-email-mike.kravetz@oracle.com \
--to=mike.kravetz@oracle.com \
--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=mhocko@suse.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;
as well as URLs for NNTP newsgroup(s).