svn commit: r253565 - in head/sys: kern vm

Gleb Smirnoff glebius at FreeBSD.org
Tue Jul 23 11:16:41 UTC 2013


Author: glebius
Date: Tue Jul 23 11:16:40 2013
New Revision: 253565
URL: http://svnweb.freebsd.org/changeset/base/253565

Log:
  Revert r249590 and in case if mp_ncpus isn't initialized use MAXCPU. This
  allows us to init counter zone at early stage of boot.
  
  Reviewed by:	kib
  Tested by:	Lytochkin Boris <lytboris gmail.com>

Modified:
  head/sys/kern/subr_counter.c
  head/sys/vm/uma_core.c

Modified: head/sys/kern/subr_counter.c
==============================================================================
--- head/sys/kern/subr_counter.c	Tue Jul 23 10:25:34 2013	(r253564)
+++ head/sys/kern/subr_counter.c	Tue Jul 23 11:16:40 2013	(r253565)
@@ -104,4 +104,4 @@ counter_startup(void)
 	uint64_pcpu_zone = uma_zcreate("uint64 pcpu", sizeof(uint64_t),
 	    NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
 }
-SYSINIT(counter, SI_SUB_CPU, SI_ORDER_FOURTH, counter_startup, NULL);
+SYSINIT(counter, SI_SUB_KMEM, SI_ORDER_ANY, counter_startup, NULL);

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c	Tue Jul 23 10:25:34 2013	(r253564)
+++ head/sys/vm/uma_core.c	Tue Jul 23 11:16:40 2013	(r253565)
@@ -1139,9 +1139,10 @@ keg_small_init(uma_keg_t keg)
 	u_int shsize;
 
 	if (keg->uk_flags & UMA_ZONE_PCPU) {
-		KASSERT(mp_ncpus > 0, ("%s: ncpus %d\n", __func__, mp_ncpus));
+		u_int ncpus = mp_ncpus ? mp_ncpus : MAXCPU;
+
 		keg->uk_slabsize = sizeof(struct pcpu);
-		keg->uk_ppera = howmany(mp_ncpus * sizeof(struct pcpu),
+		keg->uk_ppera = howmany(ncpus * sizeof(struct pcpu),
 		    PAGE_SIZE);
 	} else {
 		keg->uk_slabsize = UMA_SLAB_SIZE;


More information about the svn-src-all mailing list