From 32a6cadabcc99e27ede924a47bb4f8aa92129b0c Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Mon, 23 May 2016 16:02:08 +0200 Subject: [PATCH 203/257] uma: Add UMA_ZONE_NODRAIN flag INCOMPLETE and non-functional Obtained from: ElectroBSD --- sys/vm/uma.h | 2 +- sys/vm/uma_core.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/vm/uma.h b/sys/vm/uma.h index f4c2de8a5d25..fcdb7449f830 100644 --- a/sys/vm/uma.h +++ b/sys/vm/uma.h @@ -262,7 +262,7 @@ uma_zone_t uma_zcache_create(char *name, int size, uma_ctor ctor, uma_dtor dtor, * information in the vm_page. */ #define UMA_ZONE_SECONDARY 0x0200 /* Zone is a Secondary Zone */ -/* 0x0400 Unused */ +#define UMA_ZONE_NODRAIN 0x0400 /* Do not drain zone while in use */ #define UMA_ZONE_MAXBUCKET 0x0800 /* Use largest buckets */ #define UMA_ZONE_CACHESPREAD 0x1000 /* * Spread memory start locations across diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index e54db2a29740..560851bb10e8 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -855,6 +855,9 @@ keg_drain(uma_keg_t keg) if (keg->uk_flags & UMA_ZONE_NOFREE || keg->uk_freef == NULL) return; + if (keg->uk_flags & UMA_ZONE_NODRAIN) + return; + #ifdef UMA_DEBUG printf("%s free items: %u\n", keg->uk_name, keg->uk_free); #endif @@ -2077,6 +2080,7 @@ uma_zdestroy(uma_zone_t zone) { sx_slock(&uma_drain_lock); + zone->uz_flags &= ~UMA_ZONE_NODRAIN; zone_free_item(zones, zone, NULL, SKIP_NONE); sx_sunlock(&uma_drain_lock); } -- 2.11.0