From owner-svn-src-all@FreeBSD.ORG Thu Jun 28 02:32:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A6A31065670; Thu, 28 Jun 2012 02:32:47 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 75A468FC08; Thu, 28 Jun 2012 02:32:46 +0000 (UTC) Received: by vcbfy7 with SMTP id fy7so1450021vcb.13 for ; Wed, 27 Jun 2012 19:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=rVwVhHEuCvaT5pqKv9ZtYxKM8t/BsqREtK6z7tzRd0w=; b=DF5XD3/Is5bT0zK69C39ACnvNeIn0T4J3eq6Gl7XTnhj/ExeDxs+Mhc2w6Oi7bP2Yy YDzYSo+cj0rHPne2gDmcpFO5E897Pz1GA//N9mtUUMQ9z+FksHPSWoFkepBoDxUHRkB5 iREauh2hc/Fot7iRfAjR2UUozsXNuE6EE5mmKs/z2qwFQjAs3EXN91xBXNtcQpP1u8in ZdzewtPidDKgbbnyn2PgugcUXqDGQET2iL8bmLHkG9eVKJ+3RznQ6i4MhmSCJHPMVF8u JNElAmiF0dFOtYLGClMatu09dkx+r2+xqTARrRms1sz1bAKt+oEPurv6A4P5df3RVn4c AvNQ== MIME-Version: 1.0 Received: by 10.221.1.5 with SMTP id no5mr56635vcb.67.1340850760715; Wed, 27 Jun 2012 19:32:40 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.220.36.193 with HTTP; Wed, 27 Jun 2012 19:32:40 -0700 (PDT) In-Reply-To: <4FEBC0A2.3010708@gmail.com> References: <201206272032.q5RKWjvt031174@svn.freebsd.org> <4FEBB8C9.8070006@gmail.com> <4FEBC0A2.3010708@gmail.com> Date: Thu, 28 Jun 2012 03:32:40 +0100 X-Google-Sender-Auth: EKdAwr1O-DCetCMK2FInZsEnk78 Message-ID: From: Attilio Rao To: davidxu@freebsd.org Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r237660 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 02:32:47 -0000 2012/6/28, David Xu : > On 2012/6/28 10:21, Attilio Rao wrote: >> 2012/6/28, David Xu: >>> On 2012/6/28 4:32, Konstantin Belousov wrote: >>>> Author: kib >>>> Date: Wed Jun 27 20:32:45 2012 >>>> New Revision: 237660 >>>> URL: http://svn.freebsd.org/changeset/base/237660 >>>> >>>> Log: >>>> Optimize the handling of SC_NPROCESSORS_CONF, by using auxv AT_NCPU >>>> value if present. >>>> >>>> MFC after: 1 week >>>> >>>> Modified: >>>> head/lib/libc/gen/sysconf.c >>>> >>>> Modified: head/lib/libc/gen/sysconf.c >>>> ============================================================================== >>>> --- head/lib/libc/gen/sysconf.c Wed Jun 27 20:24:25 2012 (r237659) >>>> +++ head/lib/libc/gen/sysconf.c Wed Jun 27 20:32:45 2012 (r237660) >>>> @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); >>>> #include >>>> #include >>>> >>>> +#include >>>> #include >>>> #include >>>> #include >>>> @@ -51,6 +52,7 @@ __FBSDID("$FreeBSD$"); >>>> >>>> #include "../stdlib/atexit.h" >>>> #include "tzfile.h" /* from ../../../contrib/tzcode/stdtime */ >>>> +#include "libc_private.h" >>>> >>>> #define _PATH_ZONEINFO TZDIR /* from tzfile.h */ >>>> >>>> @@ -585,6 +587,8 @@ yesno: >>>> >>>> case _SC_NPROCESSORS_CONF: >>>> case _SC_NPROCESSORS_ONLN: >>>> + if (_elf_aux_info(AT_NCPUS,&value, sizeof(value)) == 0) >>>> + return ((long)value); >>>> mib[0] = CTL_HW; >>>> mib[1] = HW_NCPU; >>>> break; >>>> >>> Will this make controlling the number of CPU online or CPU hotplug >>> be impossible on FreeBSD ? >> If I think about hotplug CPUs I can think of other 1000 >> problems/races/bad situations to be fixed before this one, really. > These are problems only in kernel, but kib's change is about ABI > between userland and kernel, I hope we don't introduce an ABI which > is not extendable road stone. I'm not entirely sure I see the ABI breakage here. If the AT_NCPUS becames unconvenient and not correct at some point we can just fix sysconf() to not look into the aux vector anymoe. Please note that AT_NCPUS is already exported nowadays. I think this is instead a clever optimization to avoid the sysctl() (usual way to retrieve the number of CPUs). Attilio -- Peace can only be achieved by understanding - A. Einstein