From owner-freebsd-current@FreeBSD.ORG Mon Feb 25 15:56:26 2008 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 9077616A40B for ; Mon, 25 Feb 2008 15:56:26 +0000 (UTC) (envelope-from wearabnet@yahoo.ca) Received: from web33708.mail.mud.yahoo.com (web33708.mail.mud.yahoo.com [68.142.201.205]) by mx1.freebsd.org (Postfix) with SMTP id 579E413C510 for ; Mon, 25 Feb 2008 15:56:26 +0000 (UTC) (envelope-from wearabnet@yahoo.ca) Received: (qmail 97154 invoked by uid 60001); 25 Feb 2008 15:29:44 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.ca; h=Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=g047ibCrF4J25IsoLvEL974it6lYM/o+Q+t95+8DvolfaBIf4u9HRcUNL/QAFE+zZ8ZHlGsHWZLdEqiWOjhv7cKNpFjoQVIvXiGuXXZgEktJmuya5REPT7NdizY3poYd1co5F9MBuCsv/TQvJVrL/ljzTfopKExzaqc/Sbqhek8=; Received: from [82.148.96.69] by web33708.mail.mud.yahoo.com via HTTP; Mon, 25 Feb 2008 07:29:44 PST X-Mailer: YahooMailRC/818.31 YahooMailWebService/0.7.162 Date: Mon, 25 Feb 2008 07:29:44 -0800 (PST) From: Abdullah Ibn Hamad Al-Marri To: Jeff Roberson , current@freebsd.org MIME-Version: 1.0 Message-ID: <316530.95933.qm@web33708.mail.mud.yahoo.com> Content-Type: text/plain; charset=us-ascii X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: cpuset and affinity implementation 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, 25 Feb 2008 15:56:26 -0000 Jeff this is great! Would it hit RELENG_7 in the future? Regards, -Abdullah Ibn Hamad Al-Marri Arab Portal ----- Original Message ---- From: Jeff Roberson To: current@freebsd.org Sent: Monday, February 25, 2008 6:38:37 AM Subject: cpuset and affinity implementation Hello, I have implemented a new api similar to processors sets on solaris. This allows you to assign processes to sets of cpus and dynamically change those sets. This is useful for provisioning purposes to add and remove cpu resources for a particular process or group of processes. This new facility also supports binding secific threads to specific cpus which some applications may want to do. At some point in the future this will be integrated with jail so you can restrict the cpus any jail is allowed to use. This api should not be considered final and the 'cpuset' tool is quite rough. This also only works with ULE and is unfortunately intertwined with a big ULE patch I've been working on. The set management code is generic but 4BSD doesn't contain the hooks to actually constrain threads. Please see: http://people.freebsd.org/~jeff/cpuset.diff here's a couple of neat things to do with cpuset: cpuset -l 0-4 /bin/sh This creates a new group with a list (-l) of cpus 0-4 inclusive and runs sh in it. cpuset -g -p This will get (-g) the mask of cpus pid (-p) is allowed to run on. cpuset -l 0,2 -p This will restrict sh to running on cpus 0, 2 while its group is still allowed 0-4. cpuset -l 0,2 -c -p This will modify the cpuset (-c) that the sh belongs to. cpuset -l 0-3 -s 1 This will modify the set (-s) that all threads are in by default to contain the first 4 cpus leaving the rest idled. cpuset -g -i -p This will print the id of the set sh is in. cpuset -s -p This will move pid into the specified set so it may be managed with other pids in that set. Feedback is appreciated. Thanks, Jeff _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping