Lines Matching full:cache
4 * Module Name: utcache - local cache allocation routines
21 * PARAMETERS: cache_name - Ascii name for the cache
23 * max_depth - Maximum depth of the cache (in objects)
24 * return_cache - Where the new cache object is returned
28 * DESCRIPTION: Create a cache object
36 struct acpi_memory_list *cache; in acpi_os_create_cache() local
44 /* Create the cache object */ in acpi_os_create_cache()
46 cache = acpi_os_allocate(sizeof(struct acpi_memory_list)); in acpi_os_create_cache()
47 if (!cache) { in acpi_os_create_cache()
51 /* Populate the cache object and return it */ in acpi_os_create_cache()
53 memset(cache, 0, sizeof(struct acpi_memory_list)); in acpi_os_create_cache()
54 cache->list_name = cache_name; in acpi_os_create_cache()
55 cache->object_size = object_size; in acpi_os_create_cache()
56 cache->max_depth = max_depth; in acpi_os_create_cache()
58 *return_cache = cache; in acpi_os_create_cache()
66 * PARAMETERS: cache - Handle to cache object
70 * DESCRIPTION: Free all objects within the requested cache.
74 acpi_status acpi_os_purge_cache(struct acpi_memory_list *cache) in acpi_os_purge_cache() argument
81 if (!cache) { in acpi_os_purge_cache()
90 /* Walk the list of objects in this cache */ in acpi_os_purge_cache()
92 while (cache->list_head) { in acpi_os_purge_cache()
96 next = ACPI_GET_DESCRIPTOR_PTR(cache->list_head); in acpi_os_purge_cache()
97 ACPI_FREE(cache->list_head); in acpi_os_purge_cache()
99 cache->list_head = next; in acpi_os_purge_cache()
100 cache->current_depth--; in acpi_os_purge_cache()
111 * PARAMETERS: cache - Handle to cache object
115 * DESCRIPTION: Free all objects within the requested cache and delete the
116 * cache object.
120 acpi_status acpi_os_delete_cache(struct acpi_memory_list *cache) in acpi_os_delete_cache() argument
126 /* Purge all objects in the cache */ in acpi_os_delete_cache()
128 status = acpi_os_purge_cache(cache); in acpi_os_delete_cache()
133 /* Now we can delete the cache object */ in acpi_os_delete_cache()
135 acpi_os_free(cache); in acpi_os_delete_cache()
143 * PARAMETERS: cache - Handle to cache object
148 * DESCRIPTION: Release an object to the specified cache. If cache is full,
153 acpi_status acpi_os_release_object(struct acpi_memory_list *cache, void *object) in acpi_os_release_object() argument
159 if (!cache || !object) { in acpi_os_release_object()
163 /* If cache is full, just free this object */ in acpi_os_release_object()
165 if (cache->current_depth >= cache->max_depth) { in acpi_os_release_object()
167 ACPI_MEM_TRACKING(cache->total_freed++); in acpi_os_release_object()
170 /* Otherwise put this object back into the cache */ in acpi_os_release_object()
180 memset(object, 0xCA, cache->object_size); in acpi_os_release_object()
183 /* Put the object at the head of the cache list */ in acpi_os_release_object()
185 ACPI_SET_DESCRIPTOR_PTR(object, cache->list_head); in acpi_os_release_object()
186 cache->list_head = object; in acpi_os_release_object()
187 cache->current_depth++; in acpi_os_release_object()
199 * PARAMETERS: cache - Handle to cache object
203 * DESCRIPTION: Get an object from the specified cache. If cache is empty,
208 void *acpi_os_acquire_object(struct acpi_memory_list *cache) in acpi_os_acquire_object() argument
215 if (!cache) { in acpi_os_acquire_object()
224 ACPI_MEM_TRACKING(cache->requests++); in acpi_os_acquire_object()
226 /* Check the cache first */ in acpi_os_acquire_object()
228 if (cache->list_head) { in acpi_os_acquire_object()
232 object = cache->list_head; in acpi_os_acquire_object()
233 cache->list_head = ACPI_GET_DESCRIPTOR_PTR(object); in acpi_os_acquire_object()
235 cache->current_depth--; in acpi_os_acquire_object()
237 ACPI_MEM_TRACKING(cache->hits++); in acpi_os_acquire_object()
239 "%s: Object %p from %s cache\n", in acpi_os_acquire_object()
241 cache->list_name)); in acpi_os_acquire_object()
250 memset(object, 0, cache->object_size); in acpi_os_acquire_object()
252 /* The cache is empty, create a new object */ in acpi_os_acquire_object()
254 ACPI_MEM_TRACKING(cache->total_allocated++); in acpi_os_acquire_object()
257 if ((cache->total_allocated - cache->total_freed) > in acpi_os_acquire_object()
258 cache->max_occupied) { in acpi_os_acquire_object()
259 cache->max_occupied = in acpi_os_acquire_object()
260 cache->total_allocated - cache->total_freed; in acpi_os_acquire_object()
271 object = ACPI_ALLOCATE_ZEROED(cache->object_size); in acpi_os_acquire_object()