svn commit: r355707 - head/sys/vm

Ryan Libby rlibby at FreeBSD.org
Fri Dec 13 09:32:04 UTC 2019


Author: rlibby
Date: Fri Dec 13 09:32:03 2019
New Revision: 355707
URL: https://svnweb.freebsd.org/changeset/base/355707

Log:
  uma: delay bucket_init() until we might actually enable buckets
  
  This helps with a bootstrapping problem in upcoming work.
  
  We don't first enable buckets until uma_startup2(), so we can delay
  bucket creation until then.  The other two paths to bucket_enable() are
  both later, one in the pageout daemon (SI_SUB_KTHREAD_PAGE vs SI_SUB_VM)
  and one in uma_timeout() (first activated in uma_startup3()).  Note that
  although some bucket functions are accessible before uma_startup2()
  (e.g. bucket_select() in zone_ctor()), none of them inspect ubz_zone.
  
  Discussed with:	jeff
  Reviewed by:	markj
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D22765

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c	Fri Dec 13 09:31:59 2019	(r355706)
+++ head/sys/vm/uma_core.c	Fri Dec 13 09:32:03 2019	(r355707)
@@ -335,6 +335,8 @@ SYSCTL_INT(_vm, OID_AUTO, zone_warnings, CTLFLAG_RWTUN
 static void
 bucket_enable(void)
 {
+
+	KASSERT(booted >= BOOT_BUCKETS, ("Bucket enable before init"));
 	bucketdisable = vm_page_count_min();
 }
 
@@ -2299,10 +2301,10 @@ zone_foreach(void (*zfunc)(uma_zone_t, void *arg), voi
 /*
  * Count how many pages do we need to bootstrap.  VM supplies
  * its need in early zones in the argument, we add up our zones,
- * which consist of: UMA Slabs, UMA Hash and 9 Bucket zones. The
+ * which consist of the UMA Slabs and UMA Hash zones. The
  * zone of zones and zone of kegs are accounted separately.
  */
-#define	UMA_BOOT_ZONES	11
+#define	UMA_BOOT_ZONES	2
 /* Zone of zones and zone of kegs have arbitrary alignment. */
 #define	UMA_BOOT_ALIGN	32
 static int zsize, ksize;
@@ -2417,8 +2419,6 @@ uma_startup(void *mem, int npages)
 	    sizeof(struct slabhead *) * UMA_HASH_SIZE_INIT,
 	    NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZFLAG_INTERNAL);
 
-	bucket_init();
-
 	booted = BOOT_STRAPPED;
 }
 
@@ -2439,8 +2439,9 @@ uma_startup2(void)
 #ifdef DIAGNOSTIC
 	printf("Entering %s with %d boot pages left\n", __func__, boot_pages);
 #endif
-	booted = BOOT_BUCKETS;
 	sx_init(&uma_reclaim_lock, "umareclaim");
+	bucket_init();
+	booted = BOOT_BUCKETS;
 	bucket_enable();
 }
 


More information about the svn-src-all mailing list