mmap: allow unlimited overcommit

Change-Id: Iba07b5c504b4a202cd163ce682f3fc72a31284a0
This commit is contained in:
Masamichi Takagi
2020-07-10 14:52:57 +09:00
parent d78a0fd05d
commit bafe540d86
4 changed files with 15 additions and 0 deletions

View File

@ -535,3 +535,6 @@ Restrictions on McKernel
25. The behaviors of madvise and mbind are changed to do nothing and
report success as a workaround for Fugaku.
26. mmap() allows unlimited overcommit. Note that it corresponds to
setting sysctl ``vm.overcommit_memory`` to 1.

View File

@ -72,4 +72,11 @@
#define MS_INVALIDATE 0x02
#define MS_SYNC 0x04
/* include/uapi/linux/mman.h */
#define OVERCOMMIT_GUESS 0
#define OVERCOMMIT_ALWAYS 1
#define OVERCOMMIT_NEVER 2
extern int sysctl_overcommit_memory;
#endif /* HEADER_MMAN_H */

View File

@ -11,6 +11,7 @@
#include <ihk/ihk_monitor.h>
#include <ihk/debug.h>
#include <memory.h>
#include <mman.h>
#ifdef ENABLE_RUSAGE
@ -311,6 +312,9 @@ rusage_check_overmap(size_t len, int pgshift)
{
int npages = 0, remain_pages = 0;
if (sysctl_overcommit_memory == OVERCOMMIT_ALWAYS)
return 0;
npages = (len + (1UL << pgshift) - 1) >> pgshift;
remain_pages = (rusage.total_memory - rusage.total_memory_usage)
>> pgshift;

View File

@ -62,6 +62,7 @@ extern int interrupt_from_user(void *);
struct tlb_flush_entry tlb_flush_vector[IHK_TLB_FLUSH_IRQ_VECTOR_SIZE];
int anon_on_demand = 0;
int sysctl_overcommit_memory = OVERCOMMIT_ALWAYS;
static struct ihk_mc_pa_ops *pa_ops;