public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Support for userspace non-transparent superpages (largepages).
@ 2022-07-11 11:52 Sebastian Huber
  0 siblings, 0 replies; only message in thread
From: Sebastian Huber @ 2022-07-11 11:52 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1306ff4c9222e11c2c2f885e3d0fe2cc5a8d6787

commit 1306ff4c9222e11c2c2f885e3d0fe2cc5a8d6787
Author: Konstantin Belousov <kib@FreeBSD.org>
Date:   Wed Sep 9 22:12:51 2020 +0000

    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

Diff:
---
 newlib/libc/sys/rtems/include/sys/filio.h |  3 +++
 newlib/libc/sys/rtems/include/sys/mman.h  | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/include/sys/filio.h b/newlib/libc/sys/rtems/include/sys/filio.h
index c5cf3d443..3eea7a7ac 100644
--- a/newlib/libc/sys/rtems/include/sys/filio.h
+++ b/newlib/libc/sys/rtems/include/sys/filio.h
@@ -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
diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index 6d861422d..d726a80d6 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-11 11:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 11:52 [newlib-cygwin] Support for userspace non-transparent superpages (largepages) Sebastian Huber

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 read-only IMAP folder(s) and NNTP newsgroup(s).