Author: jeff
Date: Sun Apr  1 04:47:05 2018
New Revision: 331862
URL: https://svnweb.freebsd.org/changeset/base/331862

Log:
  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

Modified:
  head/sys/vm/uma.h
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma.h
==============================================================================
--- head/sys/vm/uma.h   Sun Apr  1 04:11:38 2018        (r331861)
+++ head/sys/vm/uma.h   Sun Apr  1 04:47:05 2018        (r331862)
@@ -286,6 +286,10 @@ uma_zone_t uma_zcache_create(char *name, int size, uma
                                         * 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

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c      Sun Apr  1 04:11:38 2018        (r331861)
+++ head/sys/vm/uma_core.c      Sun Apr  1 04:47:05 2018        (r331862)
@@ -2965,7 +2965,13 @@ zfree_start:
                /* 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);
        }
 
        /*
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to