diff options
author | Keir Fraser <keir@xensource.com> | 2007-02-24 14:48:17 +0000 |
---|---|---|
committer | Keir Fraser <keir@xensource.com> | 2007-02-24 14:48:17 +0000 |
commit | e0b421d24279d3cce426c0df4bf6d8734c6ce325 (patch) | |
tree | 1c085426682541ba5f472f51948d2f61d3ff0372 /tools/libxc/xc_core.c | |
parent | 6948b541999a27d5dbf3cfe05b41d34ed3765ce8 (diff) | |
download | xen-e0b421d24279d3cce426c0df4bf6d8734c6ce325.tar.gz xen-e0b421d24279d3cce426c0df4bf6d8734c6ce325.tar.bz2 xen-e0b421d24279d3cce426c0df4bf6d8734c6ce325.zip |
Reduce impact of saving/restoring/dumping large domains on Dom0 memory
usage by means of fadvise64() to tell the OS to discard the cache
pages used for the save/dump file.
Signed-off-by: Simon Graham <Simon.Graham@stratus.com>
Diffstat (limited to 'tools/libxc/xc_core.c')
-rw-r--r-- | tools/libxc/xc_core.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c index 7ea97cd6d0..31c1532b69 100644 --- a/tools/libxc/xc_core.c +++ b/tools/libxc/xc_core.c @@ -802,6 +802,12 @@ static int local_file_dump(void *args, char *buffer, unsigned int length) } } + if (length >= DUMP_INCREMENT*PAGE_SIZE) { + // Now dumping pages -- make sure we discard clean pages from + // the cache after each write + discard_file_cache(da->fd, 0 /* no flush */); + } + return 0; } @@ -822,6 +828,9 @@ xc_domain_dumpcore(int xc_handle, sts = xc_domain_dumpcore_via_callback( xc_handle, domid, &da, &local_file_dump); + /* flush and discard any remaining portion of the file from cache */ + discard_file_cache(da.fd, 1/* flush first*/); + close(da.fd); return sts; |