From owner-freebsd-smp Fri Oct 5 23:15:54 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 4D46537B407; Fri, 5 Oct 2001 23:15:48 -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 f966Fj593885; Sat, 6 Oct 2001 15:15:45 +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 f966FjE73040; Sat, 6 Oct 2001 15:15:45 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (IDENT:+jqMHwasCGHvnz5HYMZ8PgWkNYLs2I2U@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 PAA02451; Sat, 6 Oct 2001 15:25:40 +0900 (JST) Message-Id: <200110060625.PAA02451@zodiac.mech.utsunomiya-u.ac.jp> To: John Baldwin Cc: smp@freebsd.org, Alfred Perlstein , 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 "Fri, 05 Oct 2001 09:12:46 MST." References: Date: Sat, 06 Oct 2001 15:25:40 +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 >> - The following patch will add a new sysctl variable. >> >> kern.smp.kernel >> >> This will be 0 for the UP kernel and 1 for the SMP kernel. >> >> - It also make kern.smp.active available in the UP kernel as well. >> (Previously this sysctl variable was only present in the SMP >> kernel.) It will always be 0 for the UP kernel. > >This shouldn't be done. There's no need for 2 copies of the same sysctl. >Actually, userland can _already_ tell if it is an SMP kernel or not by looking >if the kern.smp.active sysctl exists. This is how top works, for example. >Thus, userland doesn't need any of this. Only in the kernel do you need this. > >Now, ideally kernel modules shouldn't care if they are on a SMP kernel or not. I agree. But, some modules need to know ;-< I was trying to make the pnpbios driver into a module and it has #ifdef SMP in it. >Why does the module in question care? The only thing I would do here is >possibly export a global variable saying if SMP was compiled in, nothing more. This is fine, as I am not very much interested in exposing to the userland which kernel configration, SMP or UP, is running. Kazu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message