public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: Jack Steiner <steiner@sgi.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] - Externel SLIT table information thru sysfs
Date: Wed, 24 Nov 2004 18:04:03 -0800	[thread overview]
Message-ID: <41A53D93.5070005@osdl.org> (raw)
In-Reply-To: <20041124165724.GA14544@sgi.com>

Jack Steiner wrote:
> The ACPI SLIT table provides useful information on internode distances.
> Here is a patch to externalize the SLIT information. 
> 
> For example:
> 
>         # cd /sys/devices/system
>         # find .
>         ./node
>         ./node/node5
>         ./node/node5/distance
>         ./node/node5/numastat
>         ./node/node5/meminfo
>         ./node/node5/cpumap
> 
>         # cat ./node/node0/distance
>         10 20 64 42 42 22
> 
>         # cat node/*/distance
>         10 20 64 42 42 22
>         20 10 42 22 64 84
>         64 42 10 20 22 42
>         42 22 20 10 42 62
>         42 64 22 42 10 20
>         22 84 42 62 20 10

Apparently I'm easily confused, but node_distance() {near end}
seems to evaluate to either 10 or 20 (only), so what are
all of these other numbers here?

And how many nodes are in this example?
Maybe 6, numbered 0 thru 5?  Plz correct this guess....

> Index: linux/drivers/base/node.c
> ===================================================================
> --- linux.orig/drivers/base/node.c	2004-11-05 08:34:42.461312000 -0600
> +++ linux/drivers/base/node.c	2004-11-05 15:56:23.345662000 -0600
> @@ -111,6 +111,24 @@ static ssize_t node_read_numastat(struct
>  }
>  static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
>  
> +static ssize_t node_read_distance(struct sys_device * dev, char * buf)
> +{
> +	int nid = dev->id;
> +	int len = 0;
> +	int i;
> +
> +	/* buf currently PAGE_SIZE, need ~4 chars per node */
> +	BUILD_BUG_ON(NR_NODES*4 > PAGE_SIZE/2);
> +
> +	for (i = 0; i < numnodes; i++)
> +		len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i));
> +		
> +	len += sprintf(buf + len, "\n");
> +	return len;
> +}
> +static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL);
> +
> +
> Index: linux/include/linux/topology.h
> ===================================================================
> --- linux.orig/include/linux/topology.h	2004-11-05 08:34:57.492932000 -0600
> +++ linux/include/linux/topology.h	2004-11-23 10:03:26.700821978 -0600
> @@ -55,7 +55,10 @@ static inline int __next_node_with_cpus(
>  	for (node = 0; node < numnodes; node = __next_node_with_cpus(node))
>  
>  #ifndef node_distance
> -#define node_distance(from,to)	((from) != (to))
> +/* Conform to ACPI 2.0 SLIT distance definitions */
> +#define LOCAL_DISTANCE		10
> +#define REMOTE_DISTANCE		20
> +#define node_distance(from,to)	((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)
Please add a space after "from,".

>  #endif

-- 
~Randy

  reply	other threads:[~2004-11-25  2:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-24 16:57 [PATCH] - Externel SLIT table information thru sysfs Jack Steiner
2004-11-25  2:04 ` Randy.Dunlap [this message]
2004-11-25  3:39   ` Greg KH
2004-11-26  3:54     ` Jack Steiner
2004-11-25 14:00   ` Jack Steiner
     [not found] <34a45-4B7-9@gated-at.bofh.it>
     [not found] ` <34hyB-2nd-21@gated-at.bofh.it>
     [not found]   ` <34iNY-3nm-27@gated-at.bofh.it>
2004-11-25 11:12     ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41A53D93.5070005@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steiner@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox