4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 04:49:25 +08:00

Support for userspace non-transparent superpages (largepages).

Created with shm_open2(SHM_LARGEPAGE) and then configured with
FIOSSHMLPGCNF ioctl, largepages posix shared memory objects guarantee
that all userspace mappings of it are served by superpage non-managed
mappings.

Only amd64 for now, both 2M and 1G superpages can be requested, the
later requires CPU feature.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D24652
This commit is contained in:
Konstantin Belousov 2020-09-09 22:12:51 +00:00 committed by Sebastian Huber
parent 1a5f14a0c5
commit 1306ff4c92
2 changed files with 15 additions and 1 deletions

View File

@ -70,6 +70,9 @@ struct fiobmap2_arg {
};
/* Get the file's bmap info for the logical block bn. */
#define FIOBMAP2 _IOWR('f', 99, struct fiobmap2_arg)
/* POSIX shm largepage set/get config */
#define FIOSSHMLPGCNF _IOW('f', 100, struct shm_largepage_conf)
#define FIOGSHMLPGCNF _IOR('f', 101, struct shm_largepage_conf)
#ifdef _KERNEL
#ifdef COMPAT_FREEBSD32

View File

@ -192,6 +192,17 @@
*/
#define SHM_ALLOW_SEALING 0x00000001
#define SHM_GROW_ON_WRITE 0x00000002
#define SHM_LARGEPAGE 0x00000004
#define SHM_LARGEPAGE_ALLOC_DEFAULT 0
#define SHM_LARGEPAGE_ALLOC_NOWAIT 1
#define SHM_LARGEPAGE_ALLOC_HARD 2
struct shm_largepage_conf {
int psind;
int alloc_policy;
int pad[10];
};
/*
* Flags for memfd_create().
@ -199,7 +210,6 @@
#define MFD_CLOEXEC 0x00000001
#define MFD_ALLOW_SEALING 0x00000002
/* UNSUPPORTED */
#define MFD_HUGETLB 0x00000004
#define MFD_HUGE_MASK 0xFC000000
@ -279,6 +289,7 @@ int shm_unlink(const char *);
#endif
#if __BSD_VISIBLE
int memfd_create(const char *, unsigned int);
int shm_create_largepage(const char *, int, int, int, mode_t);
int shm_rename(const char *, const char *, int);
#endif
__END_DECLS