summaryrefslogtreecommitdiff
path: root/sysdep/cf/linux.h
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-11-01 18:40:56 +0100
committerMaria Matejka <mq@ucw.cz>2022-11-02 12:56:54 +0100
commit9d03c3f56ced3d3191982f57029f9a3d12fa2e5a (patch)
treead1fa71442ad21704a99a18653d716b088bb2b78 /sysdep/cf/linux.h
parent37b644413723670928f6b54f2abe0c852eb0b652 (diff)
Memory pages are not munmapped, instead we just madvise()
Memory unmapping causes slow address space fragmentation, leading in extreme cases to failing to allocate pages at all. Removing this problem by keeping all the pages allocated to us, yet calling madvise() to let kernel dispose of them. This adds a little complexity and overhead as we have to keep the pointers to the free pages, therefore to hold e.g. 1 GB of 4K pages with 8B pointers, we have to store 2 MB of data.
Diffstat (limited to 'sysdep/cf/linux.h')
-rw-r--r--sysdep/cf/linux.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sysdep/cf/linux.h b/sysdep/cf/linux.h
index c640bef4..56ecf017 100644
--- a/sysdep/cf/linux.h
+++ b/sysdep/cf/linux.h
@@ -20,6 +20,7 @@
#define CONFIG_RESTRICTED_PRIVILEGES
#define CONFIG_INCLUDE_SYSPRIV_H "sysdep/linux/syspriv.h"
+#define CONFIG_MADV_DONTNEED_TO_FREE
#ifndef AF_MPLS
#define AF_MPLS 28