From c9b029efcd2551b2089d5ebb762ee64f41542562 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 1 Apr 2018 04:47:05 +0000 Subject: [PATCH] Add the flag ZONE_NOBUCKETCACHE. This flag instructions UMA not to keep a cache of fully populated buckets. This will be used in a follow-on commit. The flag idea was originally from markj. Reviewed by: markj, kib Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon --- sys/vm/uma.h | 4 ++++ sys/vm/uma_core.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/vm/uma.h b/sys/vm/uma.h index 95cd1e6d0a4d..017669363c69 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 566e0187a5e9..80cd17d00080 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -2965,7 +2965,13 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata) /* 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); } /*