From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 13:12:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2916C106566B; Wed, 27 Oct 2010 13:12:07 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F248A8FC15; Wed, 27 Oct 2010 13:12:06 +0000 (UTC) Received: from [192.168.2.105] (host86-177-32-238.range86-177.btcentralplus.com [86.177.32.238]) by cyrus.watson.org (Postfix) with ESMTPSA id BFC2A46B09; Wed, 27 Oct 2010 09:12:05 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: "Robert N. M. Watson" In-Reply-To: <4CC82195.5000201@freebsd.org> Date: Wed, 27 Oct 2010 14:12:03 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <0D9C8E2A-520C-4A45-A93F-C958DDA421C6@FreeBSD.org> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <4CC80ABA.3080404@freebsd.org> <4CC82195.5000201@freebsd.org> To: David Xu X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Garrett Cooper Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 13:12:07 -0000 On 27 Oct 2010, at 13:56, David Xu wrote: >> Yay, it's fd_set all over again :-). >>=20 >> It sounds like we might just need to add a sysctl and a few wrapper = functions in userspace along the lines of (hand-wave): >>=20 >> cpuset_t *cpuset_alloc(); >> void cpuset_free(); >>=20 >> And perhaps some sort of API that abstracts manipulation of the set = (or >> doesn't but allows the user to easily query its bounds). > Problem is who will use the non-standard interface ? The = pthread_attr_getaffinity_np pthread_attr_setaffinity_np > and others are from glibc, which let you specify arbitrary > cpuset size but kernel only accept one size. :-) >=20 > Though it is not POSIX, but some software start to use it, AFAIK, > Erlang language's VM start to use it for binding its scheduler > thread to cpu, we have to live with it. We still lack of some = functions > to let it compile without modification, one is it wants to know > cpu topology, and other crappy functions it wants to use is: > sched_getaffinity, sched_setaffinity, which one guy thought each > thread is just a process which has a PID. :-) > I don't know how it uses Solaris processor binding interface. I see two separate problems here: (1) Providing potentially non-portable APIs that do the right thing, and = do it well. (2) Providing definitely portable APIs whose implementation is as robust = as possible given their flawed semantics. I.e., don't crash on common = use. The latter should be implemented in terms of the former. Robert=