Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP4
xen.25152
libxc-sr-save-rec_pfns.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libxc-sr-save-rec_pfns.patch of Package xen.25152
From: Olaf Hering <olaf@aepfle.de> Date: Fri, 23 Oct 2020 11:34:00 +0200 Subject: libxc sr save rec_pfns tools/guest: save: move rec_pfns array Remove allocation from hotpath, move rec_pfns array into preallocated space. Signed-off-by: Olaf Hering <olaf@aepfle.de> --- tools/libxc/xc_sr_common.h | 2 ++ tools/libxc/xc_sr_save.c | 11 +---------- 2 files changed, 3 insertions(+), 10 deletions(-) --- xen-4.14.0-testing.orig/tools/libxc/xc_sr_common.h +++ xen-4.14.0-testing/tools/libxc/xc_sr_common.h @@ -222,6 +222,8 @@ struct xc_sr_save_arrays { int errors[MAX_BATCH_SIZE]; /* write_batch: iovec[] for writev(). */ struct iovec iov[MAX_BATCH_SIZE + 4]; + /* write_batch */ + uint64_t rec_pfns[MAX_BATCH_SIZE]; }; struct xc_sr_restore_arrays { --- xen-4.14.0-testing.orig/tools/libxc/xc_sr_save.c +++ xen-4.14.0-testing/tools/libxc/xc_sr_save.c @@ -96,7 +96,7 @@ static int write_batch(struct xc_sr_cont unsigned int i, p, nr_pages = 0, nr_pages_mapped = 0; unsigned int nr_pfns = ctx->save.nr_batch_pfns; void *page, *orig_page; - uint64_t *rec_pfns = NULL; + uint64_t *rec_pfns = ctx->save.m->rec_pfns; struct iovec *iov = ctx->save.m->iov; int iovcnt = 0; struct xc_sr_rec_page_data_header hdr = { 0 }; struct xc_sr_record rec = { @@ -201,14 +201,6 @@ static int write_batch(struct xc_sr_cont } } - rec_pfns = malloc(nr_pfns * sizeof(*rec_pfns)); - if ( !rec_pfns ) - { - ERROR("Unable to allocate %zu bytes of memory for page data pfn list", - nr_pfns * sizeof(*rec_pfns)); - goto err; - } - hdr.count = nr_pfns; rec.length = sizeof(hdr); @@ -259,7 +251,6 @@ static int write_batch(struct xc_sr_cont rc = ctx->save.nr_batch_pfns = 0; err: - free(rec_pfns); if ( guest_mapping ) xenforeignmemory_unmap(xch->fmem, guest_mapping, nr_pages_mapped); for ( i = 0; local_pages && i < nr_pfns; ++i )
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor