From: Dave Hansen <haveblue@us.ibm.com>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, Dave Hansen <haveblue@us.ibm.com>
Subject: [RFC][PATCH 4/4] unify both copies of build_zonelists()
Date: Tue, 20 Sep 2005 10:23:12 -0700 [thread overview]
Message-ID: <20050920172312.24651DBA@kernel.beaverton.ibm.com> (raw)
In-Reply-To: <20050920172303.8CD9190C@kernel.beaverton.ibm.com>
Once the last three patches are applied, find_next_best_node()
has three properties which make its behavior identical to the
way that the !NUMA build_zonelists() functions.
First, this code from build_zonelists():
j = 0;
k = zone_index_to_type(i);
j = build_zonelists_node(pgdat, zonelist, j, k);
makes sure that the node for which we're building a zonelist is
first in that zone's list. That is functionally equivalent to
this code in find_next_best_node():
/* Use the local node if we haven't already */
if (!node_isset(node, *used_node_mask)) {
best_node = node;
break;
}
Next, the !NUMA build_zonelists() starts at the local node,
and searches all larger-numbered nodes, then searches all
nodes from 0 back up to the local node:
for (node = local_node + 1; node < MAX_NUMNODES; node++) {
if (!node_online(node))
continue;
j = build_zonelists_node(NODE_DATA(node), zonelist, j, k);
}
for (node = 0; node < local_node; node++) {
if (!node_online(node))
continue;
j = build_zonelists_node(NODE_DATA(node), zonelist, j, k);
}
Instead of doing this explicitly, find_next_best_node()
uses a modulo but, again, the behavior is the same:
/* Start from local node */
n = (node+i) % num_online_nodes();
Lastly, "val" will be equivalent for each find_next_best_node() loop
iteration because:
1. node_distance() always return the same value (except when
node == n, but that never happens because of the local node
check above)
2. The 'if (!cpus_empty(tmp))' check will never succeed because
the cpumask for !NUMA is cpu_online_map, which is never empty.
3. (MAX_NODE_LOAD*MAX_NUMNODES) == 1
4. get_node_load() == 0
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---
memhotplug-dave/mm/page_alloc.c | 41 ----------------------------------------
1 files changed, 41 deletions(-)
diff -puN mm/page_alloc.c~B1.3-build_zonelists_unification mm/page_alloc.c
--- memhotplug/mm/page_alloc.c~B1.3-build_zonelists_unification 2005-09-14 09:32:39.000000000 -0700
+++ memhotplug-dave/mm/page_alloc.c 2005-09-14 09:32:39.000000000 -0700
@@ -1577,47 +1577,6 @@ static void __init build_zonelists(pg_da
}
}
-#else /* CONFIG_NUMA */
-
-static void __init build_zonelists(pg_data_t *pgdat)
-{
- int i, j, k, node, local_node;
-
- local_node = pgdat->node_id;
- for (i = 0; i < GFP_ZONETYPES; i++) {
- struct zonelist *zonelist;
-
- zonelist = pgdat->node_zonelists + i;
-
- j = 0;
- k = zone_index_to_type(i);
-
- j = build_zonelists_node(pgdat, zonelist, j, k);
- /*
- * Now we build the zonelist so that it contains the zones
- * of all the other nodes.
- * We don't want to pressure a particular node, so when
- * building the zones for node N, we make sure that the
- * zones coming right after the local ones are those from
- * node N+1 (modulo N)
- */
- for (node = local_node + 1; node < MAX_NUMNODES; node++) {
- if (!node_online(node))
- continue;
- j = build_zonelists_node(NODE_DATA(node), zonelist, j, k);
- }
- for (node = 0; node < local_node; node++) {
- if (!node_online(node))
- continue;
- j = build_zonelists_node(NODE_DATA(node), zonelist, j, k);
- }
-
- zonelist->zones[j] = NULL;
- }
-}
-
-#endif /* CONFIG_NUMA */
-
void __init build_all_zonelists(void)
{
int i;
diff -L b.txt -puN /dev/null /dev/null
_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2005-09-20 17:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-20 17:23 [RFC][PATCH 0/4] " Dave Hansen
2005-09-20 17:23 ` [RFC][PATCH 1/4] build_zonelists(): create zone_index_to_type() helper Dave Hansen
2005-09-20 17:23 ` [RFC][PATCH 2/4] build_zonelists(): abstract node_load[] operations Dave Hansen
2005-09-20 17:23 ` [RFC][PATCH 3/4] build_zonelists() unification: don't re-zero zonelist Dave Hansen
2005-09-20 17:23 ` Dave Hansen [this message]
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=20050920172312.24651DBA@kernel.beaverton.ibm.com \
--to=haveblue@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox