Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jun 2017 21:33:19 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319724 - head/sys/vm
Message-ID:  <201706082133.v58LXJ85099476@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Thu Jun  8 21:33:19 2017
New Revision: 319724
URL: https://svnweb.freebsd.org/changeset/base/319724

Log:
  When we are in UMA_STARTUP use startup_alloc() for any zone, not for
  internal zones only.  This allows to create new zones at early stages
  of boot, without need to mark them as internal to UMA, which isn't
  always true.
  
  Reviewed by:	alc

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c	Thu Jun  8 21:33:10 2017	(r319723)
+++ head/sys/vm/uma_core.c	Thu Jun  8 21:33:19 2017	(r319724)
@@ -1384,8 +1384,6 @@ keg_ctor(void *mem, int size, void *udata, int flags)
 	keg->uk_reserve = 0;
 	keg->uk_pages = 0;
 	keg->uk_flags = arg->flags;
-	keg->uk_allocf = page_alloc;
-	keg->uk_freef = page_free;
 	keg->uk_slabzone = NULL;
 
 	/*
@@ -1426,20 +1424,20 @@ keg_ctor(void *mem, int size, void *udata, int flags)
 	 * If we haven't booted yet we need allocations to go through the
 	 * startup cache until the vm is ready.
 	 */
-	if (keg->uk_ppera == 1) {
+	if (booted < UMA_STARTUP2)
+		keg->uk_allocf = startup_alloc;
 #ifdef UMA_MD_SMALL_ALLOC
+	else if (keg->uk_ppera == 1)
 		keg->uk_allocf = uma_small_alloc;
+#endif
+	else
+		keg->uk_allocf = page_alloc;
+#ifdef UMA_MD_SMALL_ALLOC
+	if (keg->uk_ppera == 1)
 		keg->uk_freef = uma_small_free;
-
-		if (booted < UMA_STARTUP)
-			keg->uk_allocf = startup_alloc;
-#else
-		if (booted < UMA_STARTUP2)
-			keg->uk_allocf = startup_alloc;
+	else
 #endif
-	} else if (booted < UMA_STARTUP2 &&
-	    (keg->uk_flags & UMA_ZFLAG_INTERNAL))
-		keg->uk_allocf = startup_alloc;
+		keg->uk_freef = page_free;
 
 	/*
 	 * Initialize keg's lock



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