From owner-freebsd-smp@FreeBSD.ORG Fri Feb 23 20:34:34 2007 Return-Path: X-Original-To: freebsd-smp@freebsd.org Delivered-To: freebsd-smp@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 365B316A405 for ; Fri, 23 Feb 2007 20:34:34 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outI.internet-mail-service.net (outI.internet-mail-service.net [216.240.47.232]) by mx1.freebsd.org (Postfix) with ESMTP id 0B52F13C4A3 for ; Fri, 23 Feb 2007 20:34:34 +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.32) with ESMTP; Fri, 23 Feb 2007 11:56:40 -0800 Received: from [10.251.22.38] (nat.ironport.com [63.251.108.100]) by idiom.com (Postfix) with ESMTP id DEC89125B04; Fri, 23 Feb 2007 12:21:14 -0800 (PST) Message-ID: <45DF4CBA.1010906@elischer.org> Date: Fri, 23 Feb 2007 12:21:14 -0800 From: Julian Elischer User-Agent: Thunderbird 1.5.0.9 (Macintosh/20061207) MIME-Version: 1.0 To: "Kunze, Aaron" References: <07DDDFCFB8BE0A43BCA52E743373DBDC030C5D5A@orsmsx416.amr.corp.intel.com> <20070223151158.Q88189@fledge.watson.org> <07DDDFCFB8BE0A43BCA52E743373DBDC03102190@orsmsx416.amr.corp.intel.com> In-Reply-To: <07DDDFCFB8BE0A43BCA52E743373DBDC03102190@orsmsx416.amr.corp.intel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Daniel Eischen , freebsd-smp@freebsd.org, atmblr@gmail.com, Robert Watson Subject: Re: Setting CPU affinity to process( Freebsd smp kernel) X-BeenThere: freebsd-smp@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD SMP implementation group List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2007 20:34:34 -0000 Kunze, Aaron wrote: > Thanks for the info. The Linux equivalent would be sched_setaffinity > which takes a bitmask as input, allowing the user to define which > processors will run a particular thread. Here's a link: > > http://ibm5.ma.utexas.edu/cgi-bin/man-cgi?sched_setaffinity+2 > >>> There's a potential for >>> conflict between the kernel's use of pinning and binding for kernel >>> synchronization and the user space affinity model, which will be > > Can you elaborate on this? Some of my colleagues and I are considering > tackling this and would like to avoid such pitfalls, if possible. [...] >> >> I know Solaris has processor_bind(2) and pset_bind(2): >> >> http://docs.sun.com/app/docs/doc/816-5167/6mbb2jaeu?a=expand#P I prefer the linux model but it does limit you to some set number of procesors. it looks however that the solaris interface doesn't allow 'sets' of processors but just allows you to specify a single processor. I would postulate the following syscall copied from Linux. As in Linux, the 'pid_t' can specify a TID in which case the give thread is changed I would suggest that it would have to be a thread in the current process however. (you don't allow threads to be manipulated from outside the process) It's not obvious from the man page if a pid of 0 afects the current process or thread. I read it as being process, with no way of specifying the current thread. I would add a PID/TID of (-1) to indicate 'current (kernel) thread'. In addition it is possible that a UTS mailbox might specify a set I guess for kse type threads. int sched_getaffinity(pid_t pid, unsigned int cpusetsize, cpu_set_t *mask); void CPU_CLR(int cpu, cpu_set_t *set); int CPU_ISSET(int cpu, cpu_set_t *set); void CPU_SET(int cpu, cpu_set_t *set); void CPU_ZERO(cpu_set_t *set); >> >> -- >> DE >> > _______________________________________________ > freebsd-smp@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-smp > To unsubscribe, send any mail to "freebsd-smp-unsubscribe@freebsd.org"