aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_private.h
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-02-01 19:26:36 +0000
committerIan Campbell <ian.campbell@citrix.com>2011-02-01 19:26:36 +0000
commit04d1f61a1fd9e86f4aafc6333b223b736a488b58 (patch)
tree7d595ae7fa88ca36c3967f733c19e02d7fa39395 /tools/libxc/xc_private.h
parent3ddd6a650bd220252584fdd111fa284ed062363b (diff)
downloadxen-04d1f61a1fd9e86f4aafc6333b223b736a488b58.tar.gz
xen-04d1f61a1fd9e86f4aafc6333b223b736a488b58.tar.bz2
xen-04d1f61a1fd9e86f4aafc6333b223b736a488b58.zip
libxc: maintain a small, per-handle, cache of hypercall buffer memory
Constantly m(un)locking memory can have significant overhead on systems with large numbers of CPUs. This was previously fixed by 20841:fbe8f32fa257 but this was dropped during the transition to hypercall buffers. Introduce a small cache of single page hypercall buffer allocations which can be resused to avoid this overhead. Add some statistics tracking to the hypercall buffer allocations. The cache size of 4 was chosen based on these statistics since they indicated that 2 pages was sufficient to satisfy all concurrent single page hypercall buffer allocations seen during "xl create", "xl shutdown" and "xl destroy" of both a PV and HVM guest therefore 4 pages should cover the majority of important cases. This fixes http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1719. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Reported-by: Zheng, Shaohui <shaohui.zheng@intel.com> Tested-by: Haitao Shan <maillists.shan@gmail.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_private.h')
-rw-r--r--tools/libxc/xc_private.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
index b01ca2419d..3687561df0 100644
--- a/tools/libxc/xc_private.h
+++ b/tools/libxc/xc_private.h
@@ -75,6 +75,28 @@ struct xc_interface_core {
FILE *dombuild_logger_file;
const char *currently_progress_reporting;
+ /*
+ * A simple cache of unused, single page, hypercall buffers
+ *
+ * Protected by a global lock.
+ */
+#define HYPERCALL_BUFFER_CACHE_SIZE 4
+ int hypercall_buffer_cache_nr;
+ void *hypercall_buffer_cache[HYPERCALL_BUFFER_CACHE_SIZE];
+
+ /*
+ * Hypercall buffer statistics. All protected by the global
+ * hypercall_buffer_cache lock.
+ */
+ int hypercall_buffer_total_allocations;
+ int hypercall_buffer_total_releases;
+ int hypercall_buffer_current_allocations;
+ int hypercall_buffer_maximum_allocations;
+ int hypercall_buffer_cache_hits;
+ int hypercall_buffer_cache_misses;
+ int hypercall_buffer_cache_toobig;
+
+ /* Low lovel OS interface */
xc_osdep_info_t osdep;
xc_osdep_ops *ops; /* backend operations */
xc_osdep_handle ops_handle; /* opaque data for xc_osdep_ops */
@@ -158,6 +180,11 @@ void xc__hypercall_bounce_post(xc_interface *xch, xc_hypercall_buffer_t *bounce)
#define xc_hypercall_bounce_post(_xch, _name) xc__hypercall_bounce_post(_xch, HYPERCALL_BUFFER(_name))
/*
+ * Release hypercall buffer cache
+ */
+void xc__hypercall_buffer_cache_release(xc_interface *xch);
+
+/*
* Hypercall interfaces.
*/