Merge branch 'akpm' (patches from Andrew)
Merge updates from Andrew Morton: - various misc bits - DAX updates - OCFS2 - most of MM * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (119 commits) mm,fork: introduce MADV_WIPEONFORK x86,mpx: make mpx depend on x86-64 to free up VMA flag mm: add /proc/pid/smaps_rollup mm: hugetlb: clear target sub-page last when clearing huge page mm: oom: let oom_reap_task and exit_mmap run concurrently swap: choose swap device according to numa node mm: replace TIF_MEMDIE checks by tsk_is_oom_victim mm, oom: do not rely on TIF_MEMDIE for memory reserves access z3fold: use per-cpu unbuddied lists mm, swap: don't use VMA based swap readahead if HDD is used as swap mm, swap: add sysfs interface for VMA based swap readahead mm, swap: VMA based swap readahead mm, swap: fix swap readahead marking mm, swap: add swap readahead hit statistics mm/vmalloc.c: don't reinvent the wheel but use existing llist API mm/vmstat.c: fix wrong comment selftests/memfd: add memfd_create hugetlbfs selftest mm/shmem: add hugetlbfs support to memfd_create() mm, devm_memremap_pages: use multi-order radix for ZONE_DEVICE lookups mm/vmalloc.c: halve the number of comparisons performed in pcpu_get_vm_areas() ...
This commit is contained in:
34
include/uapi/asm-generic/hugetlb_encode.h
Normal file
34
include/uapi/asm-generic/hugetlb_encode.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#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_64KB (16 << HUGETLB_FLAG_ENCODE_SHIFT)
|
||||
#define HUGETLB_FLAG_ENCODE_512KB (19 << HUGETLB_FLAG_ENCODE_SHIFT)
|
||||
#define HUGETLB_FLAG_ENCODE_1MB (20 << HUGETLB_FLAG_ENCODE_SHIFT)
|
||||
#define HUGETLB_FLAG_ENCODE_2MB (21 << HUGETLB_FLAG_ENCODE_SHIFT)
|
||||
#define HUGETLB_FLAG_ENCODE_8MB (23 << HUGETLB_FLAG_ENCODE_SHIFT)
|
||||
#define HUGETLB_FLAG_ENCODE_16MB (24 << HUGETLB_FLAG_ENCODE_SHIFT)
|
||||
#define HUGETLB_FLAG_ENCODE_256MB (28 << HUGETLB_FLAG_ENCODE_SHIFT)
|
||||
#define HUGETLB_FLAG_ENCODE_1GB (30 << HUGETLB_FLAG_ENCODE_SHIFT)
|
||||
#define HUGETLB_FLAG_ENCODE_2GB (31 << HUGETLB_FLAG_ENCODE_SHIFT)
|
||||
#define HUGETLB_FLAG_ENCODE_16GB (34 << HUGETLB_FLAG_ENCODE_SHIFT)
|
||||
|
||||
#endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */
|
||||
@@ -58,20 +58,12 @@
|
||||
overrides the coredump filter bits */
|
||||
#define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag */
|
||||
|
||||
#define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */
|
||||
#define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */
|
||||
|
||||
/* compatibility flags */
|
||||
#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.
|
||||
*/
|
||||
#define MAP_HUGE_SHIFT 26
|
||||
#define MAP_HUGE_MASK 0x3f
|
||||
|
||||
#define PKEY_DISABLE_ACCESS 0x1
|
||||
#define PKEY_DISABLE_WRITE 0x2
|
||||
#define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS |\
|
||||
|
||||
@@ -1,8 +1,32 @@
|
||||
#ifndef _UAPI_LINUX_MEMFD_H
|
||||
#define _UAPI_LINUX_MEMFD_H
|
||||
|
||||
#include <asm-generic/hugetlb_encode.h>
|
||||
|
||||
/* flags for memfd_create(2) (unsigned int) */
|
||||
#define MFD_CLOEXEC 0x0001U
|
||||
#define MFD_ALLOW_SEALING 0x0002U
|
||||
#define MFD_HUGETLB 0x0004U
|
||||
|
||||
/*
|
||||
* Huge page size encoding when MFD_HUGETLB is specified, and a huge page
|
||||
* size other than the default is desired. See hugetlb_encode.h.
|
||||
* All known huge page size encodings are provided here. It is the
|
||||
* responsibility of the application to know which sizes are supported on
|
||||
* the running system. See mmap(2) man page for details.
|
||||
*/
|
||||
#define MFD_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
|
||||
#define MFD_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
|
||||
|
||||
#define MFD_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB
|
||||
#define MFD_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB
|
||||
#define MFD_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB
|
||||
#define MFD_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB
|
||||
#define MFD_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB
|
||||
#define MFD_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB
|
||||
#define MFD_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB
|
||||
#define MFD_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB
|
||||
#define MFD_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB
|
||||
#define MFD_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
|
||||
|
||||
#endif /* _UAPI_LINUX_MEMFD_H */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define _UAPI_LINUX_MMAN_H
|
||||
|
||||
#include <asm/mman.h>
|
||||
#include <asm-generic/hugetlb_encode.h>
|
||||
|
||||
#define MREMAP_MAYMOVE 1
|
||||
#define MREMAP_FIXED 2
|
||||
@@ -10,4 +11,25 @@
|
||||
#define OVERCOMMIT_ALWAYS 1
|
||||
#define OVERCOMMIT_NEVER 2
|
||||
|
||||
/*
|
||||
* Huge page size encoding when MAP_HUGETLB is specified, and a huge page
|
||||
* size other than the default is desired. See hugetlb_encode.h.
|
||||
* All known huge page size encodings are provided here. It is the
|
||||
* responsibility of the application to know which sizes are supported on
|
||||
* the running system. See mmap(2) man page for details.
|
||||
*/
|
||||
#define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
|
||||
#define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
|
||||
|
||||
#define MAP_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB
|
||||
#define MAP_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB
|
||||
#define MAP_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB
|
||||
#define MAP_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB
|
||||
#define MAP_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB
|
||||
#define MAP_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB
|
||||
#define MAP_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB
|
||||
#define MAP_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB
|
||||
#define MAP_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB
|
||||
#define MAP_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
|
||||
|
||||
#endif /* _UAPI_LINUX_MMAN_H */
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <linux/ipc.h>
|
||||
#include <linux/errno.h>
|
||||
#include <asm-generic/hugetlb_encode.h>
|
||||
#ifndef __KERNEL__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -40,11 +41,37 @@ struct shmid_ds {
|
||||
/* Include the definition of shmid64_ds and shminfo64 */
|
||||
#include <asm/shmbuf.h>
|
||||
|
||||
/* permission flag for shmget */
|
||||
/*
|
||||
* shmget() shmflg values.
|
||||
*/
|
||||
/* The bottom nine bits are the same as open(2) mode flags */
|
||||
#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
|
||||
#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
|
||||
/* Bits 9 & 10 are IPC_CREAT and IPC_EXCL */
|
||||
#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */
|
||||
#define SHM_NORESERVE 010000 /* don't check for reservations */
|
||||
|
||||
/* mode for attach */
|
||||
/*
|
||||
* Huge page size encoding when SHM_HUGETLB is specified, and a huge page
|
||||
* size other than the default is desired. See hugetlb_encode.h
|
||||
*/
|
||||
#define SHM_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
|
||||
#define SHM_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
|
||||
|
||||
#define SHM_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB
|
||||
#define SHM_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB
|
||||
#define SHM_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB
|
||||
#define SHM_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB
|
||||
#define SHM_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB
|
||||
#define SHM_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB
|
||||
#define SHM_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB
|
||||
#define SHM_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB
|
||||
#define SHM_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB
|
||||
#define SHM_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
|
||||
|
||||
/*
|
||||
* shmat() shmflg values
|
||||
*/
|
||||
#define SHM_RDONLY 010000 /* read-only access */
|
||||
#define SHM_RND 020000 /* round attach address to SHMLBA boundary */
|
||||
#define SHM_REMAP 040000 /* take-over region on attach */
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
UFFD_FEATURE_EVENT_REMOVE | \
|
||||
UFFD_FEATURE_EVENT_UNMAP | \
|
||||
UFFD_FEATURE_MISSING_HUGETLBFS | \
|
||||
UFFD_FEATURE_MISSING_SHMEM)
|
||||
UFFD_FEATURE_MISSING_SHMEM | \
|
||||
UFFD_FEATURE_SIGBUS | \
|
||||
UFFD_FEATURE_THREAD_ID)
|
||||
#define UFFD_API_IOCTLS \
|
||||
((__u64)1 << _UFFDIO_REGISTER | \
|
||||
(__u64)1 << _UFFDIO_UNREGISTER | \
|
||||
@@ -78,6 +80,9 @@ struct uffd_msg {
|
||||
struct {
|
||||
__u64 flags;
|
||||
__u64 address;
|
||||
union {
|
||||
__u32 ptid;
|
||||
} feat;
|
||||
} pagefault;
|
||||
|
||||
struct {
|
||||
@@ -153,6 +158,13 @@ struct uffdio_api {
|
||||
* UFFD_FEATURE_MISSING_SHMEM works the same as
|
||||
* UFFD_FEATURE_MISSING_HUGETLBFS, but it applies to shmem
|
||||
* (i.e. tmpfs and other shmem based APIs).
|
||||
*
|
||||
* UFFD_FEATURE_SIGBUS feature means no page-fault
|
||||
* (UFFD_EVENT_PAGEFAULT) event will be delivered, instead
|
||||
* a SIGBUS signal will be sent to the faulting process.
|
||||
*
|
||||
* UFFD_FEATURE_THREAD_ID pid of the page faulted task_struct will
|
||||
* be returned, if feature is not requested 0 will be returned.
|
||||
*/
|
||||
#define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0)
|
||||
#define UFFD_FEATURE_EVENT_FORK (1<<1)
|
||||
@@ -161,6 +173,8 @@ struct uffdio_api {
|
||||
#define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4)
|
||||
#define UFFD_FEATURE_MISSING_SHMEM (1<<5)
|
||||
#define UFFD_FEATURE_EVENT_UNMAP (1<<6)
|
||||
#define UFFD_FEATURE_SIGBUS (1<<7)
|
||||
#define UFFD_FEATURE_THREAD_ID (1<<8)
|
||||
__u64 features;
|
||||
|
||||
__u64 ioctls;
|
||||
|
||||
Reference in New Issue
Block a user