Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP4
xen.23267
libxc-sr-save-iov.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libxc-sr-save-iov.patch of Package xen.23267
From: Olaf Hering <olaf@aepfle.de> Date: Fri, 23 Oct 2020 11:30:41 +0200 Subject: libxc sr save iov tools/guest: save: move iov array Remove allocation from hotpath, move iov 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 | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) --- xen-4.14.0-testing.orig/tools/libxc/xc_sr_common.h +++ xen-4.14.0-testing/tools/libxc/xc_sr_common.h @@ -220,6 +220,8 @@ struct xc_sr_save_arrays { xen_pfn_t types[MAX_BATCH_SIZE]; /* write_batch: Errors from attempting to map the gfns. */ int errors[MAX_BATCH_SIZE]; + /* write_batch: iovec[] for writev(). */ + struct iovec iov[MAX_BATCH_SIZE + 4]; }; 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 @@ -97,7 +97,7 @@ static int write_batch(struct xc_sr_cont unsigned int nr_pfns = ctx->save.nr_batch_pfns; void *page, *orig_page; uint64_t *rec_pfns = NULL; - struct iovec *iov = NULL; int iovcnt = 0; + struct iovec *iov = ctx->save.m->iov; int iovcnt = 0; struct xc_sr_rec_page_data_header hdr = { 0 }; struct xc_sr_record rec = { .type = REC_TYPE_PAGE_DATA, @@ -109,10 +109,8 @@ static int write_batch(struct xc_sr_cont guest_data = calloc(nr_pfns, sizeof(*guest_data)); /* Pointers to locally allocated pages. Need freeing. */ local_pages = calloc(nr_pfns, sizeof(*local_pages)); - /* iovec[] for writev(). */ - iov = malloc((nr_pfns + 4) * sizeof(*iov)); - if ( !guest_data || !local_pages || !iov ) + if ( !guest_data || !local_pages ) { ERROR("Unable to allocate arrays for a batch of %u pages", nr_pfns); @@ -266,7 +264,6 @@ static int write_batch(struct xc_sr_cont xenforeignmemory_unmap(xch->fmem, guest_mapping, nr_pages_mapped); for ( i = 0; local_pages && i < nr_pfns; ++i ) free(local_pages[i]); - free(iov); free(local_pages); free(guest_data);
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