Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jul 2013 11:16:40 +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: r253565 - in head/sys: kern vm
Message-ID:  <201307231116.r6NBGe6E081216@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



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