From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1921) id 623413854152; Mon, 11 Jul 2022 11:52:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 623413854152 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Sebastian Huber To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Support for userspace non-transparent superpages (largepages). X-Act-Checkin: newlib-cygwin X-Git-Author: Konstantin Belousov X-Git-Refname: refs/heads/master X-Git-Oldrev: 1a5f14a0c547c6c7ecddaeb5171a80ed28ab3316 X-Git-Newrev: 1306ff4c9222e11c2c2f885e3d0fe2cc5a8d6787 Message-Id: <20220711115229.623413854152@sourceware.org> Date: Mon, 11 Jul 2022 11:52:29 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2022 11:52:29 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D1306ff4c922= 2e11c2c2f885e3d0fe2cc5a8d6787 commit 1306ff4c9222e11c2c2f885e3d0fe2cc5a8d6787 Author: Konstantin Belousov Date: Wed Sep 9 22:12:51 2020 +0000 Support for userspace non-transparent superpages (largepages). =20 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. =20 Only amd64 for now, both 2M and 1G superpages can be requested, the later requires CPU feature. =20 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/rt= ems/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) =20 #ifdef _KERNEL #ifdef COMPAT_FREEBSD32 diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rte= ms/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]; +}; =20 /* * Flags for memfd_create(). @@ -199,7 +210,6 @@ #define MFD_CLOEXEC 0x00000001 #define MFD_ALLOW_SEALING 0x00000002 =20 -/* UNSUPPORTED */ #define MFD_HUGETLB 0x00000004 =20 #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