12.07.2015 Views

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

POOL_CACHE (9) <strong>NetBSD</strong> <strong>Kernel</strong> Developer’s <strong>Manual</strong> POOL_CACHE (9)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 objectobject or POOL_PADDR_INVALID. pp. Ifthe number of available items in the backingpool exceeds the maximum pool size set by pool_cache_sethiwat() and there are no outstandingrequests for pool items, the excess items will be returned to the system.pool_cache_put(pc , object)pool_cache_put() is the same as pool_cache_put_paddr() withPOOL_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 objects in the global cache. Per-CPU cacheswill not be invalidated by this call, meaning that it is still possible to allocate "stale" items fromthe cache. If relevant, the user must check for this condition when allocating items.pool_cache_sethiwat(pc , nitems)Apool will attempt to increase its resource usage to keep up with the demand for its items. Conversely,itwill return unused memory to the system should the number of accumulated unuseditems in the pool exceed a programmable limit. The limits for the minimum and maximum numberof items which a pool should keep at hand are known as the high and low watermarks.The function pool_cache_sethiwat() sets the backing pool’s high water mark. As itemsare returned and the total number of pages in the pool is larger than the maximum set by thisfunction, any completely unused pages are released immediately. Ifthis function is not used tospecify a maximum number of items, the pages will remain associated with the pool until the systemruns low onmemory, atwhich point the VM system will try to reclaim unused pages.pool_cache_setlowat(pc , nitems)Set the minimum number of items to keep in the pool. The number pages in the pool will notdecrease below the required value to accommodate the minimum number of items specified bythis function.CODE REFERENCESThis section describes places within the <strong>NetBSD</strong> source tree where actual code implementing thepool_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 ALSOintro(9), kmem_alloc(9), kmem_free(9), memoryallocators(9), pool(9)<strong>NetBSD</strong> 3.0 Febuary 1, 2008 3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!