diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -495,7 +495,7 @@ ktls_buffer_zone = uma_zcache_create("ktls_buffers", roundup2(ktls_maxlen, PAGE_SIZE), NULL, NULL, NULL, NULL, ktls_buffer_import, ktls_buffer_release, NULL, - UMA_ZONE_FIRSTTOUCH); + UMA_ZONE_FIRSTTOUCH | UMA_ZONE_NOTRIM); } /* diff --git a/sys/vm/uma.h b/sys/vm/uma.h --- a/sys/vm/uma.h +++ b/sys/vm/uma.h @@ -252,6 +252,7 @@ #define UMA_ZONE_SECONDARY 0x0200 /* Zone is a Secondary Zone */ #define UMA_ZONE_NOBUCKET 0x0400 /* Do not use buckets. */ #define UMA_ZONE_MAXBUCKET 0x0800 /* Use largest buckets. */ +#define UMA_ZONE_NOTRIM 0x1000 /* Don't trim this zone */ #define UMA_ZONE_CACHESPREAD 0x2000 /* * Spread memory start locations across * all possible cache lines. May diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1222,7 +1222,7 @@ trim: /* Trim caches not used for a long time. */ - if ((zone->uz_flags & UMA_ZONE_UNMANAGED) == 0) { + if ((zone->uz_flags & (UMA_ZONE_UNMANAGED | UMA_ZONE_NOTRIM)) == 0) { for (int i = 0; i < vm_ndomains; i++) { if (bucket_cache_reclaim_domain(zone, false, false, i) && (zone->uz_flags & UMA_ZFLAG_CACHE) == 0) @@ -5306,8 +5306,13 @@ struct uma_reclaim_args *args; args = arg; - if ((zone->uz_flags & UMA_ZONE_UNMANAGED) == 0) - uma_zone_reclaim_domain(zone, args->req, args->domain); + if ((zone->uz_flags & UMA_ZONE_UNMANAGED) != 0) + return; + if ((args->req == UMA_RECLAIM_TRIM) && + (zone->uz_flags & UMA_ZONE_NOTRIM) !=0) + return; + + uma_zone_reclaim_domain(zone, args->req, args->domain); } /* See uma.h */