[CRIU] [PATCH 6/6] Replace PAGE_SIZE in rst_mem_grow
Christopher Covington
cov at codeaurora.org
Mon Oct 6 11:50:18 PDT 2014
This fixes the second instance of the following error for AArch64
kernels with CONFIG_ARM64_64K_PAGES=y.
Error (rst-malloc.c:194): Can't mremap rst mem: Invalid argument
Signed-off-by: Christopher Covington <cov at codeaurora.org>
---
rst-malloc.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/rst-malloc.c b/rst-malloc.c
index aecefea..dc3c75b 100644
--- a/rst-malloc.c
+++ b/rst-malloc.c
@@ -1,5 +1,7 @@
#include <stdio.h>
#include <stdbool.h>
+#include <unistd.h>
+
#include <sys/mman.h>
#include "rst-malloc.h"
@@ -18,15 +20,16 @@ struct rst_mem_type_s {
unsigned long size;
};
-#define RST_MEM_BATCH (2 * PAGE_SIZE)
-
static inline unsigned long rst_mem_grow(unsigned long need_size)
{
- need_size = round_up(need_size, PAGE_SIZE);
- if (likely(need_size < RST_MEM_BATCH))
- need_size = RST_MEM_BATCH;
+ unsigned long rst_mem_batch = 2 * sysconf(_SC_PAGESIZE);
+
+ need_size = page_align(need_size);
+ if (likely(need_size < rst_mem_batch))
+ need_size = rst_mem_batch;
else
- pr_debug("Growing rst memory %lu pages\n", need_size / PAGE_SIZE);
+ pr_debug("Growing rst memory %lu pages\n",
+ need_size / sysconf(_SC_PAGESIZE));
return need_size;
}
--
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by the Linux Foundation.
More information about the CRIU
mailing list