diff options
author | Maria Matejka <mq@ucw.cz> | 2023-01-23 19:51:24 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2023-01-23 19:51:24 +0100 |
commit | 21b772fd4394feeb875121051c868eb9b738cb48 (patch) | |
tree | ad36ec41ff73d82c3e0694c609e87bc6bddec3e6 /sysdep | |
parent | 758aabd96c0f09709183dff4261ffbfdd72ae870 (diff) | |
parent | 928a1cb034e6f9e8edcdd1dc07264cd703e00827 (diff) |
Merge commit '928a1cb034e6f9e8edcdd1dc07264cd703e00827' into thread-next
Diffstat (limited to 'sysdep')
-rw-r--r-- | sysdep/bsd/krt-sock.c | 2 | ||||
-rw-r--r-- | sysdep/cf/README | 3 | ||||
-rw-r--r-- | sysdep/cf/linux.h | 1 | ||||
-rw-r--r-- | sysdep/unix/alloc.c | 10 |
4 files changed, 15 insertions, 1 deletions
diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index 8e457c79..ca1c9e89 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -209,7 +209,7 @@ struct ks_msg memcpy(p, body, (l > sizeof(*p) ? sizeof(*p) : l));\ body += l;} -static inline void +static inline void UNUSED sockaddr_fill_dl(struct sockaddr_dl *sa, struct iface *ifa) { uint len = OFFSETOF(struct sockaddr_dl, sdl_data); diff --git a/sysdep/cf/README b/sysdep/cf/README index 68078bbe..af65aaec 100644 --- a/sysdep/cf/README +++ b/sysdep/cf/README @@ -14,3 +14,6 @@ CONFIG_DONTROUTE_UNICAST Use MSG_DONTROUTE flag for unicast packets (def for Fre CONFIG_USE_HDRINCL Use IP_HDRINCL instead of control messages for source address on raw IP sockets. CONFIG_RESTRICTED_PRIVILEGES Implements restricted privileges using drop_uid() + +CONFIG_MADV_DONTNEED_TO_FREE To free pages, use MADV_DONTNEED instead of MADV_FREE (linux) +CONFIG_DISABLE_THP Disable transparent huge pages (linux) diff --git a/sysdep/cf/linux.h b/sysdep/cf/linux.h index 9c37dd8a..5edc4969 100644 --- a/sysdep/cf/linux.h +++ b/sysdep/cf/linux.h @@ -24,6 +24,7 @@ #define CONFIG_INCLUDE_SYSPRIV_H "sysdep/linux/syspriv.h" #define CONFIG_MADV_DONTNEED_TO_FREE +#define CONFIG_DISABLE_THP #ifndef AF_MPLS #define AF_MPLS 28 diff --git a/sysdep/unix/alloc.c b/sysdep/unix/alloc.c index 3ea10c32..030fb9c1 100644 --- a/sysdep/unix/alloc.c +++ b/sysdep/unix/alloc.c @@ -20,6 +20,10 @@ #include <sys/mman.h> #endif +#ifdef CONFIG_DISABLE_THP +#include <sys/prctl.h> +#endif + long page_size = 0; #ifdef HAVE_MMAP @@ -293,6 +297,12 @@ page_cleanup(void *_ UNUSED) void resource_sys_init(void) { +#ifdef CONFIG_DISABLE_THP + /* Disable transparent huge pages, they do not work properly with madvice(MADV_DONTNEED) */ + if (prctl(PR_SET_THP_DISABLE, (unsigned long) 1, (unsigned long) 0, (unsigned long) 0, (unsigned long) 0) < 0) + die("prctl(PR_SET_THP_DISABLE) failed: %m"); +#endif + #ifdef HAVE_MMAP /* Check what page size the system supports */ if (!(page_size = sysconf(_SC_PAGESIZE))) |