diff options
author | jeff <jeff@FreeBSD.org> | 2013-06-17 03:43:47 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2013-06-17 03:43:47 +0000 |
commit | 1980616f65e0f5a9bfb09904be92bc18ec636319 (patch) | |
tree | 617d22c3d82015d8ca2c2b8273fbcd0c3a2020c4 /sys/vm/uma.h | |
parent | a5442c0a6f621cd11c2b504e6a749b4eebc4b7fc (diff) | |
download | FreeBSD-src-1980616f65e0f5a9bfb09904be92bc18ec636319.zip FreeBSD-src-1980616f65e0f5a9bfb09904be92bc18ec636319.tar.gz |
- Add a new UMA API: uma_zcache_create(). This makes a zone without any
backing memory that is only a container for per-cpu caches of arbitrary
pointer items. These zones have no kegs.
- Convert the regular keg based allocator to use the new import/release
functions.
- Move some stats to be atomics since they would require excessive zone
locking/unlocking with the new import/release paradigm. Make
zone_free_item simpler now that callers can manage more stats.
- Check for these cache-only zones in the public APIs and debugging
code by checking zone_first_keg() against NULL.
Sponsored by: EMC / Isilong Storage Division
Diffstat (limited to 'sys/vm/uma.h')
-rw-r--r-- | sys/vm/uma.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/vm/uma.h b/sys/vm/uma.h index c26bcc8..c85f50d 100644 --- a/sys/vm/uma.h +++ b/sys/vm/uma.h @@ -124,6 +124,16 @@ typedef int (*uma_init)(void *mem, int size, int flags); typedef void (*uma_fini)(void *mem, int size); /* + * Import new memory into a cache zone. + */ +typedef int (*uma_import)(void *arg, void **store, int count, int flags); + +/* + * Free memory from a cache zone. + */ +typedef void (*uma_release)(void *arg, void **store, int count); + +/* * What's the difference between initializing and constructing? * * The item is initialized when it is cached, and this is the state that the @@ -216,6 +226,19 @@ uma_zone_t uma_zsecond_create(char *name, uma_ctor ctor, uma_dtor dtor, int uma_zsecond_add(uma_zone_t zone, uma_zone_t master); /* + * Create cache-only zones. + * + * This allows uma's per-cpu cache facilities to handle arbitrary + * pointers. Consumers must specify the import and release functions to + * fill and destroy caches. UMA does not allocate any memory for these + * zones. The 'arg' parameter is passed to import/release and is caller + * specific. + */ +uma_zone_t uma_zcache_create(char *name, uma_ctor ctor, uma_dtor dtor, + uma_init zinit, uma_fini zfini, uma_import zimport, + uma_release zrelease, void *arg, int flags); + +/* * Definitions for uma_zcreate flags * * These flags share space with UMA_ZFLAGs in uma_int.h. Be careful not to |