mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 01:51:51 +00:00
Use run-time page_size() for mremap
The old and new address parameters passed to the mremap system call must be page size aligned. On AArch64, the page size can only be correctly determined at run time. This fixes the following errors for CRIU on AArch64 kernels with CONFIG_ARM64_64K_PAGES=y. call mremap(0x3ffb7d50000, 8192, 8192, MAYMOVE | FIXED, 0x2a000) Error (rst-malloc.c:201): Can't mremap rst mem: Invalid argument call mremap(0x3ffb7d90000, 8192, 8192, MAYMOVE | FIXED, 0x32000) Error (rst-malloc.c:201): Can't mremap rst mem: Invalid argument Signed-off-by: Christopher Covington <cov@codeaurora.org> Acked-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
b61224bffe
commit
69d008d567
@ -1,6 +1,8 @@
|
||||
#ifndef __CR_ASM_PAGE_H__
|
||||
#define __CR_ASM_PAGE_H__
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef PAGE_SHIFT
|
||||
# define PAGE_SHIFT 12
|
||||
#endif
|
||||
|
@ -2687,7 +2687,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
|
||||
BUILD_BUG_ON(sizeof(struct task_restore_args) & 1);
|
||||
BUILD_BUG_ON(sizeof(struct thread_restore_args) & 1);
|
||||
|
||||
args_len = round_up(sizeof(*task_args) + sizeof(*thread_args) * current->nr_threads, PAGE_SIZE);
|
||||
args_len = round_up(sizeof(*task_args) + sizeof(*thread_args) * current->nr_threads, page_size());
|
||||
pr_info("%d threads require %ldK of memory\n",
|
||||
current->nr_threads, KBYTES(args_len));
|
||||
|
||||
|
12
rst-malloc.c
12
rst-malloc.c
@ -18,15 +18,15 @@ 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;
|
||||
int rst_mem_batch = 2 * page_size();
|
||||
|
||||
need_size = round_up(need_size, page_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 / page_size());
|
||||
return need_size;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user