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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to