diff --git a/sys/vm/uma.h b/sys/vm/uma.h index 95cd1e6d0a4..017669363c6 100644 --- a/sys/vm/uma.h +++ b/sys/vm/uma.h @@ -286,6 +286,10 @@ 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 diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 566e0187a5e..80cd17d0008 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -2965,7 +2965,13 @@ zfree_start: /* ub_cnt is pointing to the last free item */ KASSERT(bucket->ub_cnt != 0, ("uma_zfree: Attempting to insert an empty bucket onto the full list.\n")); - LIST_INSERT_HEAD(&zdom->uzd_buckets, bucket, ub_link); + if ((zone->uz_flags & UMA_ZONE_NOBUCKETCACHE) != 0) { + ZONE_UNLOCK(zone); + bucket_drain(zone, bucket); + bucket_free(zone, bucket, udata); + goto zfree_restart; + } else + LIST_INSERT_HEAD(&zdom->uzd_buckets, bucket, ub_link); } /*