summaryrefslogtreecommitdiffstats
path: root/sys/vm/uma.h
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2004-08-02 00:18:36 +0000
committergreen <green@FreeBSD.org>2004-08-02 00:18:36 +0000
commit9532ab7116a36e60ae15ec463c757a7d2e7f9b39 (patch)
treeff53102435294d83e0ddcbd011824aa65f84e3c8 /sys/vm/uma.h
parent14a50c4ac0247a8950847156b4fc16cf935c14ca (diff)
downloadFreeBSD-src-9532ab7116a36e60ae15ec463c757a7d2e7f9b39.zip
FreeBSD-src-9532ab7116a36e60ae15ec463c757a7d2e7f9b39.tar.gz
* Add a "how" argument to uma_zone constructors and initialization functions
so that they know whether the allocation is supposed to be able to sleep or not. * Allow uma_zone constructors and initialation functions to return either success or error. Almost all of the ones in the tree currently return success unconditionally, but mbuf is a notable exception: the packet zone constructor wants to be able to fail if it cannot suballocate an mbuf cluster, and the mbuf allocators want to be able to fail in general in a MAC kernel if the MAC mbuf initializer fails. This fixes the panics people are seeing when they run out of memory for mbuf clusters. * Allow debug.nosleepwithlocks on WITNESS to be disabled, without changing the default. Both bmilekic and jeff have reviewed the changes made to make failable zone allocations work.
Diffstat (limited to 'sys/vm/uma.h')
-rw-r--r--sys/vm/uma.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/vm/uma.h b/sys/vm/uma.h
index ff7975d..bcfb5bb 100644
--- a/sys/vm/uma.h
+++ b/sys/vm/uma.h
@@ -54,15 +54,17 @@ typedef struct uma_zone * uma_zone_t;
* item A pointer to the memory which has been allocated.
* arg The arg field passed to uma_zalloc_arg
* size The size of the allocated item
+ * flags See zalloc flags
*
* Returns:
- * Nothing
+ * 0 on success
+ * errno on failure
*
* Discussion:
* The constructor is called just before the memory is returned
* to the user. It may block if necessary.
*/
-typedef void (*uma_ctor)(void *mem, int size, void *arg);
+typedef int (*uma_ctor)(void *mem, int size, void *arg, int flags);
/*
* Item destructor
@@ -88,15 +90,17 @@ typedef void (*uma_dtor)(void *mem, int size, void *arg);
* Arguments:
* item A pointer to the memory which has been allocated.
* size The size of the item being initialized.
+ * flags See zalloc flags
*
* Returns:
- * Nothing
+ * 0 on success
+ * errno on failure
*
* Discussion:
* The initializer is called when the memory is cached in the uma zone.
* this should be the same state that the destructor leaves the object in.
*/
-typedef void (*uma_init)(void *mem, int size);
+typedef int (*uma_init)(void *mem, int size, int flags);
/*
* Item discard function
OpenPOWER on IntegriCloud