Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 29 Oct 2002 18:37:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 29 Oct 2002 18:37:15 -0500 Received: from ophelia.ess.nec.de ([193.141.139.8]:17322 "EHLO ophelia.ess.nec.de") by vger.kernel.org with ESMTP id convert rfc822-to-8bit; Tue, 29 Oct 2002 18:37:13 -0500 Content-Type: text/plain; charset=US-ASCII From: Erich Focht To: colpatch@us.ibm.com Subject: Re: [PATCH] topology for ia64 Date: Wed, 30 Oct 2002 00:43:01 +0100 User-Agent: KMail/1.4.1 Cc: davidm@hpl.hp.com, linux-ia64 , linux-kernel References: <200210051904.22480.efocht@ess.nec.de> <200210221123.37145.efocht@ess.nec.de> <3DBF096D.6080703@us.ibm.com> In-Reply-To: <3DBF096D.6080703@us.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Message-Id: <200210300043.01786.efocht@ess.nec.de> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3404 Lines: 87 On Tuesday 29 October 2002 23:19, Matthew Dobson wrote: > Hi Erich! Apologies for the long response delay... I think our mail > server must be a bit lagged. ;) Should I use another email address? > It looks good to me. As far as this comment: > +/* > + * Returns the number of the first CPU on Node 'node'. > + * Slow in the current implementation. > + * Who needs this? > + */ > +/* #define __node_to_first_cpu(node) pool_cpus[pool_ptr[node]] */ > +static inline int __node_to_first_cpu(int node) > > No one is using it now. I think that I will probably deprecate this > function in the near future as it is pretty useless. Anyone looking for > that functionality can just do an __ffs(__node_to_cpu_mask(node)) > instead, and hope that there is a reasonably quick implementation of > __node_to_cpu_mask. Yes, I know of one usage meanwhile. The problem I see is: as far as I understand the CPUs are not sorted by the node numbers. The NUMA API doesn't require that, I think. So finding the first CPU in a node is not really useful for looping over the CPUs of only one node. When you think of further developments of the NUMA API, I'd suggest two: 1: Add a sorted list of the nodes and a pointer array into that list pointing to the first CPU in the node. Like int node_cpus[NR_CPUS]; int node_first_ptr[MAX_NUMNODES+1]; (or macros, doesn't matter). Example: 2 nodes: node_cpus : 0 1 4 5 2 3 6 7 node : 0 0 0 0 1 1 1 1 pointer : ^ ^ ^ => node_first_ptr[]: 0 4 8 One can initialize this easilly by using the __cpu_to_node() macro. And with this you can loop over the cpus of one node by doing: for (i=node_first_ptr[node]; i