From owner-freebsd-arch@FreeBSD.ORG Thu Dec 20 18:18:57 2007 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 996D516A419 for ; Thu, 20 Dec 2007 18:18:57 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outO.internet-mail-service.net (outO.internet-mail-service.net [216.240.47.238]) by mx1.freebsd.org (Postfix) with ESMTP id 74A7213C459 for ; Thu, 20 Dec 2007 18:18:57 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Thu, 20 Dec 2007 10:04:49 -0800 Received: from julian-mac.elischer.org (localhost [127.0.0.1]) by idiom.com (Postfix) with ESMTP id 2F984126FD6; Thu, 20 Dec 2007 10:04:49 -0800 (PST) Message-ID: <476AAEC0.2070008@elischer.org> Date: Thu, 20 Dec 2007 10:04:48 -0800 From: Julian Elischer User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Jeff Roberson References: <20071219211025.T899@desktop> In-Reply-To: <20071219211025.T899@desktop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: arch@freebsd.org Subject: Re: Linux compatible setaffinity. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2007 18:18:57 -0000 Jeff Roberson wrote: > I have implemented a linux compatible sched_setaffinity() call which is > somewhat crippled. This allows a userspace process to supply a bitmask > of processors which it will run on. I have copied the linux interface > such that it should be api compatible because I believe it is a sensible > interface and they beat us to it by 3 years. > > My implementation is crippled in that it supports binding by curthread > only and to a single cpu only. Neither of the schedulers presently > support binding to multiple cpus or binding a non-curthread thread. > This property is not inherited by forked threads and does not effect > other threads in the same process. These two limitations can gradually > be weakened without effecting the syscall api. > > The linux api is: > int sched_setaffinity(pid_t pid, unsigned int cpusetsize, cpu_set_t > *mask); > > The cpu_set_t is the same as a fdset for select. The cpusetsize > argument is used to determine the size of the array in mask. > > I'm mostly interested in feedback on how best to reduce the namespace > pollution and avoid pulling the sched.h file into the generated syscall > files (sysproto.h, etc). Anyone who feels this is a terrible interface > for such a thing should speak up now. > > I also feel that in the medium term we will have to deal with machines > with more cores than bits in their native word. Using these CPU_SET, > CPU_CLR macros is a fine way to deal with this issue. > > I also have a primitive 'taskset', although I don't like the name, it > allows you to run arbitrary programs bound to a single cpu. makes sense to me.. don't forget the man page! > > Thanks, > Jeff > > > ------------------------------------------------------------------------ > > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"