From: jbarnes@sgi.com (Jesse Barnes)
To: linux-ia64@vger.kernel.org
Subject: Re: [PATCH] fix build_zonelists for CONFIG_ACPI_NUMA
Date: Thu, 18 Sep 2003 15:38:32 +0000 [thread overview]
Message-ID: <marc-linux-ia64-106389966219366@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-106383460616067@msgid-missing>
On Thu, Sep 18, 2003 at 05:16:33PM +0200, Erich Focht wrote:
> this kind of patch is a GOOD THING!
Glad you approve! ;)
> I just have an objection regarding the sort order. On my computers
> (and on yours maybe too) I have matrices of the form:
>
> 10 15 15 15
> 15 10 15 15
> 15 15 10 15
> 15 15 15 10
>
> Now just sorting the distance matrix row by row leads to the following
> zonelists:
> for node 1: 1, 2, 3, 4
> for node 2: 2, 1, 3, 4
> for node 3: 3, 1, 2, 4
> for node 4: 4, 1, 2, 3
>
> The first node in the list is fine and we'll get memory from the right
> node if it is free. But if not, we'll request memory from the second
> node in the zonelist and this will be (in most of the cases) node
> 1. Which means a pretty bad imbalance.
Yeah, that's a good point. We should fix that.
> I'd prefer to see this more in a round-robin way, this would ease
> things. The following piece of (ugly) code does this, but expects that
> the existing values (in the example: 10 and 15) have been sorted into
> the array node_levels[].
Sounds good.
> #define node_distance(from,to) (acpi20_slit[from * numnodes + to])
I should use this in my code, I think it'll make it more readable :).
> static void __init
> permute_nodes(int curr, int *array)
> {
> int lev, perm, node, dist=0, minown, nodes=0;
>
> array[nodes++] = curr;
> if (nr_node_levels = 1) return;
> for (node=0; node < numnodes; node++) {
> dist = node_distance(curr,node);
> if (dist = node_levels[1] || dist = node_levels[0])
> break;
> }
> minown = node;
> dist=0;
> for (lev=1; lev < nr_node_levels; lev++) {
> if (lev > 1) {
> for (perm=1; perm < numnodes; perm++) {
> node = (curr + perm) % numnodes;
> if (node_distance(curr, node) = node_levels[lev])
> break;
> }
> dist = perm + curr - minown;
> }
> for (perm=0; perm < numnodes; perm++) {
> node = (curr + perm + dist) % numnodes;
> if (node_distance(curr, node) = node_levels[lev])
> array[nodes++] = node;
> }
> }
> }
I'll look at integrating something like this into my patch and reposting
it.
Thanks,
Jesse
next prev parent reply other threads:[~2003-09-18 15:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-17 21:31 [PATCH] fix build_zonelists for CONFIG_ACPI_NUMA Jesse Barnes
2003-09-18 15:16 ` Erich Focht
2003-09-18 15:38 ` Jesse Barnes [this message]
2003-09-18 16:49 ` Erich Focht
2003-09-18 19:59 ` Jesse Barnes
2003-09-18 20:04 ` Jesse Barnes
2003-09-19 16:56 ` Erich Focht
2003-09-19 17:07 ` Jesse Barnes
2003-09-19 17:49 ` Paul Jackson
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=marc-linux-ia64-106389966219366@msgid-missing \
--to=jbarnes@sgi.com \
--cc=linux-ia64@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.