From owner-freebsd-current@FreeBSD.ORG Tue Oct 25 18:09:14 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 366031065676; Tue, 25 Oct 2011 18:09:14 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id E7F5B8FC0A; Tue, 25 Oct 2011 18:09:13 +0000 (UTC) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id CF48E5DAD; Tue, 25 Oct 2011 18:09:12 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.5/8.14.5) with ESMTP id p9PI9C0R099484; Tue, 25 Oct 2011 18:09:12 GMT (envelope-from phk@phk.freebsd.dk) To: John Baldwin From: "Poul-Henning Kamp" In-Reply-To: Your message of "Tue, 25 Oct 2011 13:42:45 -0400." <201110251342.45194.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1 Date: Tue, 25 Oct 2011 18:09:12 +0000 Message-ID: <99483.1319566152@critter.freebsd.dk> Cc: freebsd-current@freebsd.org, Luigi Rizzo Subject: Re: getting the cpuid for a userspace process ? 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: Tue, 25 Oct 2011 18:09:14 -0000 In message <201110251342.45194.jhb@freebsd.org>, John Baldwin writes: >On Tuesday, October 25, 2011 11:06:22 am Luigi Rizzo wrote: >> as the subject says... is there any way to get the current >> CPU id for a userspace process (of course, >> valid only at the time the function is called as the >> process might be arbitrarily moved while it runs) > >Not from userland, no. On x86 you can use cpuid to fetch the APIC ID, but >that does not map 1:1 to FreeBSD cpu IDs. How does JEmalloc do it ? -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.