From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 6 23:38:19 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from localhost.my.domain (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 49B8516A415; Fri, 6 Oct 2006 23:38:18 +0000 (UTC) (envelope-from davidxu@freebsd.org) From: David Xu To: freebsd-hackers@freebsd.org Date: Sat, 7 Oct 2006 07:38:12 +0800 User-Agent: KMail/1.8.2 References: <20061004214040.GA6878@porthos.spock.org> <200610050829.36266.davidxu@freebsd.org> <20061006174504.c4af61ba.stas@FreeBSD.org> In-Reply-To: <20061006174504.c4af61ba.stas@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200610070738.12529.davidxu@freebsd.org> Cc: Stanislav Sedov , Jonathan Chen Subject: Re: running code on all CPUs X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Oct 2006 23:38:19 -0000 On Friday 06 October 2006 21:45, Stanislav Sedov wrote: > > AFAIK, you can use scheduler API, the sched_bind() moves current thread > > to a specific CPU, hope this helps. > > You can find examples e.g. in hwpmc driver. Just grep by sched_bin. > > -- > Stanislav Sedov [[§²§à§ã§ã§Ú§ñ, §®§à§ã§Ü§Ó§Ñ]] > PGP id: 0xEB269581 http://people.freebsd.org/~stas/stas.key.asc sched_pin is different than sched_bind, sched_pin only pins current thread on current cpu, but sched_bind allows a thread to migrate to another CPU, after the sched_bind returns, the thread should already be running on the specified CPU, it makes it possible that a thread can iterate through all available CPUs. David Xu