|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-4.1-testing] libxc: Replace malloc with alloca in hot path
# HG changeset patch
# User Santosh Jodh <santosh.jodh@xxxxxxxxxx>
# Date 1331113150 0
# Node ID b7efb9e1a041f46baa9816025d8bf33dd1976db8
# Parent 1f95b55ef427144fc32759445791037f6b2c358d
libxc: Replace malloc with alloca in hot path
Replace malloc with alloc in hot paths for improved performance.
Signed-off-by: Santosh Jodh <santosh.jodh@xxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
xen-unstable changeset: 24709:8ba7ae0b070b
xen-unstable date: Tue Feb 07 18:46:50 2012 +0000
---
diff -r 1f95b55ef427 -r b7efb9e1a041 tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c Wed Mar 07 09:34:26 2012 +0000
+++ b/tools/libxc/xc_linux_osdep.c Wed Mar 07 09:39:10 2012 +0000
@@ -218,7 +218,7 @@
* IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to
* IOCTL_PRIVCMD_MMAPBATCH.
*/
- xen_pfn_t *pfn = malloc(num * sizeof(*pfn));
+ xen_pfn_t *pfn = alloca(num * sizeof(*pfn));
if ( pfn )
{
@@ -264,8 +264,6 @@
break;
}
- free(pfn);
-
if ( rc == -ENOENT && i == num )
rc = 0;
else if ( rc )
@@ -532,7 +530,7 @@
void *addr = NULL;
int i;
- map = malloc(sizeof(*map) +
+ map = alloca(sizeof(*map) +
(count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
if ( map == NULL )
return NULL;
@@ -567,7 +565,6 @@
}
out:
- free(map);
return addr;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |