From 07cba9d3712affe4305ae5b709dc9e6a5730b863 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 18 Nov 2021 14:37:03 -0500 Subject: [PATCH] feat: madvise hugepage --- runtime/src/sandbox.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/src/sandbox.c b/runtime/src/sandbox.c index 85c0f3a9..37f9122a 100644 --- a/runtime/src/sandbox.c +++ b/runtime/src/sandbox.c @@ -46,6 +46,9 @@ sandbox_allocate_memory(struct module *module) assert(addr != NULL); + /* Advise to use huge pages */ + if (madvise(addr, size_to_alloc, MADV_HUGEPAGE) != 0) perror("Huge Pages"); + /* Set the struct sandbox, HTTP Req/Resp buffer, and the initial Wasm Pages as read/write */ errno = 0; void *addr_rw = mmap(addr, size_to_read_write, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,