pool_cache(9) - NetBSD Manual Pages

POOL_CACHE(9)          NetBSD Kernel Developer's Manual          POOL_CACHE(9)


NAME
pool_cache, pool_cache_init, pool_cache_destroy, pool_cache_get_paddr, pool_cache_get, pool_cache_put_paddr, pool_cache_put, pool_cache_destruct_object, pool_cache_invalidate -- resource-pool cache manager
SYNOPSIS
#include <sys/pool.h> void pool_cache_init(struct pool_cache *pc, struct pool *pp, int (*ctor)(void *, void *, int), void (*dtor)(void *, void *), void *arg); void pool_cache_destroy(struct pool_cache *pc); void * pool_cache_get_paddr(struct pool_cache *pc, int flags, paddr_t *pap); void * pool_cache_get(struct pool_cache *pc, int flags); void pool_cache_put_paddr(struct pool_cache *pc, void *object, paddr_t pa); void pool_cache_put(struct pool_cache *pc, void *object); void pool_cache_destruct_object(struct pool_cache *pc, void *object); void pool_cache_invalidate(struct pool_cache *pc);
DESCRIPTION
The pool_cache utility routines are provided to support caching of con- structed objects, similar to the Solaris SLAB allocator. pool_cache uses pool(9) to allocate memory areas used for objects. If the pool must be protected from interrupts, pool_cache routines expect to be called at the appropriate interrupt priority level.
FUNCTIONS
pool_cache_init(pc, pp, ctor, dtor, arg) Initialize a pool cache pc. The pool pp should be initialized by the caller in advance. ctor and dtor are object constructor and destructor. They can be NULL. pool_cache_destroy(pc) Destroy a pool cache pc. pool_cache_get_paddr(pc, flags, pap) Get an object from a pool cache pc. If pap is not NULL, physi- cal address of the object or POOL_PADDR_INVALID will be returned via it. flags will be passed to pool_get() function of the backing pool(9) and the object constructor specified when the pool cache is created by pool_cache_init(). pool_cache_get(pc, flags) pool_cache_get() is the same as pool_cache_get_paddr() with NULL pap argument. It's implemented as a macro. pool_cache_put_paddr(pc, object, pa) Put an object object back to the pool cache pc. pa should be physical address of the object object or POOL_PADDR_INVALID. pool_cache_put(pc, object) pool_cache_put() is the same as pool_cache_put_paddr() with POOL_PADDR_INVALID pa argument. It's implemented as a macro. pool_cache_destruct_object(pc, object) Force destruction of an object object and its release back into the pool. pool_cache_invalidate(pc) Invalidate a pool cache pc. Destruct and release all of the cached objects.
CODE REFERENCES
This section describes places within the NetBSD source tree where actual code implementing the pool_cache subsystem can be found. All pathnames are relative to /usr/src. The pool_cache subsystem is implemented within the file sys/kern/subr_pool.c.
SEE ALSO
intro(9), malloc(9), pool(9) NetBSD 3.0 September 8, 2003 NetBSD 3.0

Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.