[RFC][PATCH 2/4] build_zonelists(): abstract node_load[] operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We're shortly going to use find_next_best_node() for both
NUMA and non-NUMA configurations.  So, take node_load[],
and hide it behind a couple of helper functions that are
noops when NUMA is off.

Signed-off-by: Dave Hansen <[email protected]>
---

 memhotplug-dave/mm/page_alloc.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff -puN mm/page_alloc.c~B1.1-build_zonelists_unification mm/page_alloc.c
--- memhotplug/mm/page_alloc.c~B1.1-build_zonelists_unification	2005-09-14 09:32:38.000000000 -0700
+++ memhotplug-dave/mm/page_alloc.c	2005-09-14 09:32:38.000000000 -0700
@@ -1463,9 +1463,25 @@ static inline zone_index_to_type(int ind
 }
 
 
-#ifdef CONFIG_NUMA
 #define MAX_NODE_LOAD (num_online_nodes())
+
+#ifdef CONFIG_NUMA
 static int __initdata node_load[MAX_NUMNODES];
+static int __init get_node_load(int node)
+{
+	return node_load[node];
+}
+static void __init increment_node_load(int node, int load)
+{
+	node_load[node] += load;
+}
+#else
+static inline int get_node_load(int node)
+{
+	return 0;
+}
+static inline void increment_node_load(int node, int load) {}
+#endif
 /**
  * find_next_best_node - find the next node that should appear in a given node's fallback list
  * @node: node whose fallback list we're appending
@@ -1512,7 +1528,7 @@ static int __init find_next_best_node(in
 
 		/* Slight preference for less loaded node */
 		val *= (MAX_NODE_LOAD*MAX_NUMNODES);
-		val += node_load[n];
+		val += get_node_load(n);
 
 		if (val < min_val) {
 			min_val = val;
@@ -1552,7 +1568,7 @@ static void __init build_zonelists(pg_da
 		 */
 		if (node_distance(local_node, node) !=
 				node_distance(local_node, prev_node))
-			node_load[node] += load;
+			increment_node_load(node, load);
 		prev_node = node;
 		load--;
 		for (i = 0; i < GFP_ZONETYPES; i++) {
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux