Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Aug 2018 17:58:02 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r338389 - stable/11/sys/vm
Message-ID:  <201808291758.w7THw2Ll028069@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Aug 29 17:58:01 2018
New Revision: 338389
URL: https://svnweb.freebsd.org/changeset/base/338389

Log:
  MFC r332968:
  Add a UMA zone flag to disable the use of buckets.

Modified:
  stable/11/sys/vm/uma.h
  stable/11/sys/vm/uma_core.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/uma.h
==============================================================================
--- stable/11/sys/vm/uma.h	Wed Aug 29 17:51:15 2018	(r338388)
+++ stable/11/sys/vm/uma.h	Wed Aug 29 17:58:01 2018	(r338389)
@@ -262,8 +262,8 @@ uma_zone_t uma_zcache_create(char *name, int size, uma
 					 * information in the vm_page.
 					 */
 #define	UMA_ZONE_SECONDARY	0x0200	/* Zone is a Secondary Zone */
-/*				0x0400	   Unused */
-#define	UMA_ZONE_MAXBUCKET	0x0800	/* Use largest buckets */
+#define	UMA_ZONE_NOBUCKET	0x0400	/* Do not use buckets. */
+#define	UMA_ZONE_MAXBUCKET	0x0800	/* Use largest buckets. */
 #define	UMA_ZONE_CACHESPREAD	0x1000	/*
 					 * Spread memory start locations across
 					 * all possible cache lines.  May

Modified: stable/11/sys/vm/uma_core.c
==============================================================================
--- stable/11/sys/vm/uma_core.c	Wed Aug 29 17:51:15 2018	(r338388)
+++ stable/11/sys/vm/uma_core.c	Wed Aug 29 17:58:01 2018	(r338389)
@@ -1644,10 +1644,15 @@ zone_ctor(void *mem, int size, void *udata, int flags)
 	}
 
 out:
-	if ((arg->flags & UMA_ZONE_MAXBUCKET) == 0)
-		zone->uz_count = bucket_select(zone->uz_size);
-	else
+	KASSERT((arg->flags & (UMA_ZONE_MAXBUCKET | UMA_ZONE_NOBUCKET)) !=
+	    (UMA_ZONE_MAXBUCKET | UMA_ZONE_NOBUCKET),
+	    ("Invalid zone flag combination"));
+	if ((arg->flags & UMA_ZONE_MAXBUCKET) != 0)
 		zone->uz_count = BUCKET_MAX;
+	else if ((arg->flags & UMA_ZONE_NOBUCKET) != 0)
+		zone->uz_count = 0;
+	else
+		zone->uz_count = bucket_select(zone->uz_size);
 	zone->uz_count_min = zone->uz_count;
 
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808291758.w7THw2Ll028069>