From owner-freebsd-smp Thu Oct 4 5: 1:40 2001 Delivered-To: freebsd-smp@freebsd.org Received: from nasu.utsunomiya-u.ac.jp (nasu.utsunomiya-u.ac.jp [160.12.128.3]) by hub.freebsd.org (Postfix) with ESMTP id 9143F37B403 for ; Thu, 4 Oct 2001 05:01:36 -0700 (PDT) Received: from nantai.utsunomiya-u.ac.jp by nasu.utsunomiya-u.ac.jp (8.11.2/1.1.29.3/26Jan01-1134AM) id f94C1Z551076; Thu, 4 Oct 2001 21:01:35 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp by nantai.utsunomiya-u.ac.jp (8.11.2/1.1.29.3/30Jan01-0241PM) id f94C1ZQ517154; Thu, 4 Oct 2001 21:01:35 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (IDENT:tBgl1KMJatyK4+Hkg+x5ET8/MUS2Yb3q@zodiac.mech.utsunomiya-u.ac.jp [160.12.43.7]) by zodiac.mech.utsunomiya-u.ac.jp (8.9.3+3.2W/3.7W/zodiac-May2000) with ESMTP id VAA24646; Thu, 4 Oct 2001 21:11:31 +0900 (JST) Message-Id: <200110041211.VAA24646@zodiac.mech.utsunomiya-u.ac.jp> To: smp@freebsd.org Cc: yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: Re: How to distinguish the SMP kernel and the UP kernel In-reply-to: Your message of "Wed, 03 Oct 2001 12:30:31 MST." <3BBB6757.9A668E99@mindspring.com> References: <200110030310.MAA13836@zodiac.mech.utsunomiya-u.ac.jp> <3BBB6757.9A668E99@mindspring.com> Date: Thu, 04 Oct 2001 21:11:30 +0900 From: Kazutaka YOKOTA Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org # moved to smp ML, to which this thread should have been posted # in the first place :-) >Kazutaka YOKOTA wrote: >> >> Is there any way for the loadable module to detect if >> the kernel is configured for SMP or UP? > >There is a global variable, "ncpu". Its name may have changed >recently, so you will want to look at the SYSCTL() stuff in >/sys/i386/i386 to be sure. > >-- Terry The sysctl variable hw.ncpu returns 1 in the UP kernel, and returns the number of active CPUs in the SMP kernel. When hw.ncpu == 1, it doesn't necessarily signifies the kernel is configured for UP. Because it is perfectly permissible to run the SMP kernel on the multi-CPU motherboard with only one CPU installed... Am I wrong? Kazu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message