Lines Matching refs:xcall

23     xtl_log(xcall->logger, XTL_DEBUG, -1, "xencall:buffer", _m)
29 static void cache_lock(xencall_handle *xcall) in cache_lock() argument
32 if ( xcall->flags & XENCALL_OPENFLAG_NON_REENTRANT ) in cache_lock()
39 static void cache_unlock(xencall_handle *xcall) in cache_unlock() argument
42 if ( xcall->flags & XENCALL_OPENFLAG_NON_REENTRANT ) in cache_unlock()
49 static void *cache_alloc(xencall_handle *xcall, size_t nr_pages) in cache_alloc() argument
53 cache_lock(xcall); in cache_alloc()
55 xcall->buffer_total_allocations++; in cache_alloc()
56 xcall->buffer_current_allocations++; in cache_alloc()
57 if ( xcall->buffer_current_allocations > xcall->buffer_maximum_allocations ) in cache_alloc()
58 xcall->buffer_maximum_allocations = xcall->buffer_current_allocations; in cache_alloc()
62 xcall->buffer_cache_toobig++; in cache_alloc()
64 else if ( xcall->buffer_cache_nr > 0 ) in cache_alloc()
66 p = xcall->buffer_cache[--xcall->buffer_cache_nr]; in cache_alloc()
67 xcall->buffer_cache_hits++; in cache_alloc()
71 xcall->buffer_cache_misses++; in cache_alloc()
74 cache_unlock(xcall); in cache_alloc()
79 static int cache_free(xencall_handle *xcall, void *p, size_t nr_pages) in cache_free() argument
83 cache_lock(xcall); in cache_free()
85 xcall->buffer_total_releases++; in cache_free()
86 xcall->buffer_current_allocations--; in cache_free()
89 xcall->buffer_cache_nr < BUFFER_CACHE_SIZE ) in cache_free()
91 xcall->buffer_cache[xcall->buffer_cache_nr++] = p; in cache_free()
95 cache_unlock(xcall); in cache_free()
100 void buffer_release_cache(xencall_handle *xcall) in buffer_release_cache() argument
104 cache_lock(xcall); in buffer_release_cache()
107 xcall->buffer_total_allocations, in buffer_release_cache()
108 xcall->buffer_total_releases); in buffer_release_cache()
110 xcall->buffer_current_allocations, in buffer_release_cache()
111 xcall->buffer_maximum_allocations); in buffer_release_cache()
113 xcall->buffer_cache_nr); in buffer_release_cache()
115 xcall->buffer_cache_hits, in buffer_release_cache()
116 xcall->buffer_cache_misses, in buffer_release_cache()
117 xcall->buffer_cache_toobig); in buffer_release_cache()
119 while ( xcall->buffer_cache_nr > 0 ) in buffer_release_cache()
121 p = xcall->buffer_cache[--xcall->buffer_cache_nr]; in buffer_release_cache()
122 osdep_free_pages(xcall, p, 1); in buffer_release_cache()
125 cache_unlock(xcall); in buffer_release_cache()
128 void *xencall_alloc_buffer_pages(xencall_handle *xcall, size_t nr_pages) in xencall_alloc_buffer_pages() argument
130 void *p = cache_alloc(xcall, nr_pages); in xencall_alloc_buffer_pages()
133 p = osdep_alloc_pages(xcall, nr_pages); in xencall_alloc_buffer_pages()
143 void xencall_free_buffer_pages(xencall_handle *xcall, void *p, size_t nr_pages) in xencall_free_buffer_pages() argument
148 if ( !cache_free(xcall, p, nr_pages) ) in xencall_free_buffer_pages()
149 osdep_free_pages(xcall, p, nr_pages); in xencall_free_buffer_pages()
156 void *xencall_alloc_buffer(xencall_handle *xcall, size_t size) in xencall_alloc_buffer() argument
162 hdr = xencall_alloc_buffer_pages(xcall, nr_pages); in xencall_alloc_buffer()
171 void xencall_free_buffer(xencall_handle *xcall, void *p) in xencall_free_buffer() argument
181 xencall_free_buffer_pages(xcall, hdr, hdr->nr_pages); in xencall_free_buffer()