aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/uma.h
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2019-01-15 00:02:06 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2019-01-15 00:02:06 +0000
commitbb15d1c77834836c32a6ce7e586e4ec4c784ae7f (patch)
treee32945886083e02d02d7c65d6a69a5de8ad6b5c4 /sys/vm/uma.h
parent76c528d3509c759d6e18253644e727e6cc633d4c (diff)
o Move zone limit from keg level up to zone level. This means that now
two zones sharing a keg may have different limits. Now this is going to work: zone = uma_zcreate(); uma_zone_set_max(zone, limit); zone2 = uma_zsecond_create(zone); uma_zone_set_max(zone2, limit2); Kegs no longer have uk_maxpages field, but zones have uz_items. When set, it may be rounded up to minimum possible CPU bucket cache size. For small limits bucket cache can also be reconfigured to be smaller. Counter uz_items is updated whenever items transition from keg to a bucket cache or directly to a consumer. If zone has uz_maxitems set and it is reached, then we are going to sleep. o Since new limits don't play well with multi-keg zones, remove them. The idea of multi-keg zones was introduced exactly 10 years ago, and never have had a practical usage. In discussion with Jeff we came to a wild agreement that if we ever want to reintroduce the idea of a smart allocator that would be able to choose between two (or more) totally different backing stores, that choice should be made one level higher than UMA, e.g. in malloc(9) or in mget(), or whatever and choice should be controlled by the caller. o Sleeping code is improved to account number of sleepers and wake them one by one, to avoid thundering herd problem. o Flag UMA_ZONE_NOBUCKETCACHE removed, instead uma_zone_set_maxcache() KPI added. Having no bucket cache basically means setting maxcache to 0. o Now with many fields added and many removed (no multi-keg zones!) make sure that struct uma_zone is perfectly aligned. Reviewed by: markj, jeff Tested by: pho Differential Revision: https://reviews.freebsd.org/D17773
Notes
Notes: svn path=/head/; revision=343026
Diffstat (limited to 'sys/vm/uma.h')
-rw-r--r--sys/vm/uma.h27
1 files changed, 12 insertions, 15 deletions
diff --git a/sys/vm/uma.h b/sys/vm/uma.h
index 06a3f3545cfb..ef45e3c16ff3 100644
--- a/sys/vm/uma.h
+++ b/sys/vm/uma.h
@@ -218,17 +218,6 @@ uma_zone_t uma_zsecond_create(char *name, uma_ctor ctor, uma_dtor dtor,
uma_init zinit, uma_fini zfini, uma_zone_t master);
/*
- * Add a second master to a secondary zone. This provides multiple data
- * backends for objects with the same size. Both masters must have
- * compatible allocation flags. Presently, UMA_ZONE_MALLOC type zones are
- * the only supported.
- *
- * Returns:
- * Error on failure, 0 on success.
- */
-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
@@ -285,10 +274,6 @@ uma_zone_t uma_zcache_create(char *name, int size, uma_ctor ctor, uma_dtor dtor,
* NUMA aware Zone. Implements a best
* effort first-touch policy.
*/
-#define UMA_ZONE_NOBUCKETCACHE 0x20000 /*
- * Don't cache full buckets. Limit
- * UMA to per-cpu state.
- */
/*
* These flags are shared between the keg and zone. In zones wishing to add
@@ -512,6 +497,18 @@ int uma_zone_reserve_kva(uma_zone_t zone, int nitems);
int uma_zone_set_max(uma_zone_t zone, int nitems);
/*
+ * Sets a high limit on the number of items allowed in zone's bucket cache
+ *
+ * Arguments:
+ * zone The zone to limit
+ * nitems The requested upper limit on the number of items allowed
+ *
+ * Returns:
+ * int The effective value of nitems set
+ */
+int uma_zone_set_maxcache(uma_zone_t zone, int nitems);
+
+/*
* Obtains the effective limit on the number of items in a zone
*
* Arguments: