[CRIU] [PATCH 2/2] parasite: remove redundant mmap on pages dump
Kinsbursky Stanislav
skinsbursky at openvz.org
Wed Feb 22 12:32:47 EST 2012
Current heap has 10 MB free space. It should be enough. Otherwise something
broken by design..
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
parasite.c | 23 +++++------------------
1 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/parasite.c b/parasite.c
index 60de4df..45bdb72 100644
--- a/parasite.c
+++ b/parasite.c
@@ -129,7 +129,6 @@ static int dump_pages(struct parasite_dump_pages_args *args)
parasite_status_t *st = &args->status;
unsigned long nrpages, pfn, length;
unsigned long prot_old, prot_new;
- unsigned char *map_brk = NULL;
unsigned char *map;
int ret = PARASITE_ERR_FAIL, fd;
@@ -149,19 +148,10 @@ static int dump_pages(struct parasite_dump_pages_args *args)
* otherwise call for mmap.
*/
map = brk_alloc(nrpages);
- if (map) {
- map_brk = map;
- } else {
- map = (void *)sys_mmap(NULL, nrpages,
- PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS,
- -1, 0);
- if ((long)map < 0) {
- sys_write_msg("sys_mmap failed\n");
- SET_PARASITE_STATUS(st, PARASITE_ERR_MMAP, (long)map);
- ret = st->ret;
- goto err;
- }
+ if (!map) {
+ SET_PARASITE_STATUS(st, PARASITE_ERR_MMAP, (long)map);
+ ret = st->ret;
+ goto err;
}
/*
@@ -238,10 +228,7 @@ static int dump_pages(struct parasite_dump_pages_args *args)
SET_PARASITE_STATUS(st, ret, ret);
err_free:
- if (map_brk)
- brk_free(nrpages);
- else
- sys_munmap(map, nrpages);
+ brk_free(nrpages);
err:
return ret;
}
More information about the CRIU
mailing list