From owner-freebsd-current@FreeBSD.ORG Mon Sep 27 17:41:11 2010 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BFE3106566C; Mon, 27 Sep 2010 17:41:11 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 5A1E08FC15; Mon, 27 Sep 2010 17:41:09 +0000 (UTC) Received: by gwb15 with SMTP id 15so1978133gwb.13 for ; Mon, 27 Sep 2010 10:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=dPP8ZJowvhZZIOOs0zoq7nOpOHSfqbXwem3sJRsJQ00=; b=u51KYm3N9w/YVLoeZ5Ent3xZ4vGBcUtEAficeEhDv67OkKZzlLWeJ8zykobepe1Uxs zC511fTt6R79XNi5mXXzSb/y1QGgZX0h1an+AE7mMpkYChwG4hrCyT98V3YS84yylEVl 1gGepjDjnjLkppeqMZ8KR4KUJjpe5fGH55JtA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=wnM+yXVCTWaE1peO0lmK4cIekqW4uKizT9nrD/pnc5WuCjPFdbB7+xouDo7Smrib7V +2tcgMwVErckP57vKs1zpwf5rOCen9xQ+pTOJI4uVRjCf0lwXlB0WXvPm4XnoVjjYusJ ac3X4lJwxcuYa9+UhXy4vHdExTTP+uyTSbxR8= MIME-Version: 1.0 Received: by 10.150.50.15 with SMTP id x15mr9624200ybx.35.1285609269332; Mon, 27 Sep 2010 10:41:09 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.151.15.4 with HTTP; Mon, 27 Sep 2010 10:41:09 -0700 (PDT) In-Reply-To: <1285604516.7245.16.camel@home-yahoo> References: <1285601161.7245.7.camel@home-yahoo> <4CA0BE08.50408@freebsd.org> <1285604516.7245.16.camel@home-yahoo> Date: Mon, 27 Sep 2010 19:41:09 +0200 X-Google-Sender-Auth: wR2rb5EexVQKygpd7ll0TzBKrqc Message-ID: From: Attilio Rao To: Sean Bruno Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "sbruno@freebsd.org" , "current@freebsd.org" Subject: Re: MAXCPU preparations X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 17:41:11 -0000 2010/9/27 Sean Bruno : > On Mon, 2010-09-27 at 08:53 -0700, Julian Elischer wrote: >> On 9/27/10 8:26 AM, Sean Bruno wrote: >> > Does this look like an appropriate modification to libmemstat? >> > >> > Sean >> > >> > >> > =3D=3D=3D=3D //depot/yahoo/ybsd_7/src/lib/libmemstat/memstat.h#4 >> > - /home/seanbru/ybsd_7/src/lib/libmemstat/memstat.h =3D=3D=3D=3D >> > @@ -28,12 +28,13 @@ >> > >> > =C2=A0 #ifndef _MEMSTAT_H_ >> > =C2=A0 #define =C2=A0 =C2=A0 =C2=A0 =C2=A0_MEMSTAT_H_ >> > +#include >> > >> > =C2=A0 /* >> > =C2=A0 =C2=A0* Number of CPU slots in library-internal data structures= . =C2=A0This >> > should be >> > =C2=A0 =C2=A0* at least the value of MAXCPU from param.h. >> > =C2=A0 =C2=A0*/ >> > -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0MEMSTAT_MAXCPU =C2=A064 >> > +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0MEMSTAT_MAXCPU =C2=A0MAXCPU /* def= ined in >> > sys/${ARCH}/include/param.h */ >> > >> >> >> wouldn't it be better to do a sysctlbyname() and use the real value >> for the system? >> > > That was my initial thought (as prodded by scottl and peter). > > If it is made dynamic, could this be opening a race condition where the > call to sysctlbyname() returns a count of CPUS that is in turn changed > by the offlining of a CPU? =C2=A0Or am I thinking to much about this? We still can't support CPU hotplugging so the easy answer is 'don't bother about variadic CPUs number'. I don't really know what libmemstat is willing to do with that macro (and I don't have time to look at it now) maybe you could shade a light about what's its usage? Does it really needs to know MAXCPUS or just wants a large enough value to fill anything? Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein