[CRIU] [crtools-bot for Kinsbursky Stanislav ] parasite: remove
redundant mmap on pages dump
Cyrill Gorcunov
gorcunov at openvz.org
Tue Feb 28 06:34:06 EST 2012
The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 722398dae3d143e670b7571aeb2027149656a3da
Author: Kinsbursky Stanislav <skinsbursky at openvz.org>
Date: Tue Feb 28 13:34:31 2012 +0300
parasite: remove redundant mmap on pages dump
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>
Acked-by: Pavel Emelyanov <xemul at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
parasite.c | 23 +++++------------------
1 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/parasite.c b/parasite.c
index 41fa124..830bea3 100644
--- a/parasite.c
+++ b/parasite.c
@@ -142,7 +142,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;
@@ -162,19 +161,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;
}
/*
@@ -251,10 +241,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