[PATCH] refine for_each_pgdat() [3/4] remove pgdat sorting

From: KAMEZAWA Hiroyuki
Date: Wed Feb 22 2006 - 06:06:50 EST


Because pgdat_list was linked to pgdat_list in *reverse* order,
(by default) some of arch has to sort it by themselves.

Because for_each_pgdat uses node_online_map now, it traverses all pgdat
in order. The bootmem allocater is sorted. So, we can get rid of
arch-specific sorting codes.


Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>


Index: linux-2.6.16-rc4/arch/m32r/mm/discontig.c
===================================================================
--- linux-2.6.16-rc4.orig/arch/m32r/mm/discontig.c
+++ linux-2.6.16-rc4/arch/m32r/mm/discontig.c
@@ -137,12 +137,6 @@ unsigned long __init zone_sizes_init(voi
int nid, i;
mem_prof_t *mp;

- pgdat_list = NULL;
- for (nid = num_online_nodes() - 1 ; nid >= 0 ; nid--) {
- NODE_DATA(nid)->pgdat_next = pgdat_list;
- pgdat_list = NODE_DATA(nid);
- }
-
for_each_online_node(nid) {
mp = &mem_prof[nid];
for (i = 0 ; i < MAX_NR_ZONES ; i++) {
Index: linux-2.6.16-rc4/arch/ia64/mm/discontig.c
===================================================================
--- linux-2.6.16-rc4.orig/arch/ia64/mm/discontig.c
+++ linux-2.6.16-rc4/arch/ia64/mm/discontig.c
@@ -379,31 +379,6 @@ static void __init *memory_less_node_all
}

/**
- * pgdat_insert - insert the pgdat into global pgdat_list
- * @pgdat: the pgdat for a node.
- */
-static void __init pgdat_insert(pg_data_t *pgdat)
-{
- pg_data_t *prev = NULL, *next;
-
- for_each_pgdat(next)
- if (pgdat->node_id < next->node_id)
- break;
- else
- prev = next;
-
- if (prev) {
- prev->pgdat_next = pgdat;
- pgdat->pgdat_next = next;
- } else {
- pgdat->pgdat_next = pgdat_list;
- pgdat_list = pgdat;
- }
-
- return;
-}
-
-/**
* memory_less_nodes - allocate and initialize CPU only nodes pernode
* information.
*/
Index: linux-2.6.16-rc4/arch/i386/mm/discontig.c
===================================================================
--- linux-2.6.16-rc4.orig/arch/i386/mm/discontig.c
+++ linux-2.6.16-rc4/arch/i386/mm/discontig.c
@@ -352,17 +352,6 @@ void __init zone_sizes_init(void)
{
int nid;

- /*
- * Insert nodes into pgdat_list backward so they appear in order.
- * Clobber node 0's links and NULL out pgdat_list before starting.
- */
- pgdat_list = NULL;
- for (nid = MAX_NUMNODES - 1; nid >= 0; nid--) {
- if (!node_online(nid))
- continue;
- NODE_DATA(nid)->pgdat_next = pgdat_list;
- pgdat_list = NODE_DATA(nid);
- }

for_each_online_node(nid) {
unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/