Skip to contentSkip to conversation

Memoryless nodes: Update memory policy and page migration

PATCH KAMEZAWA Hiroyuki 4 participants 8 messages Jul 11, 2007 5 messages not in the archive Memory management

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive

Review

Quoted 2 lines · On Tue, 10 Jul 2007 14:52:15 -0700 Christoph Lameter <[email protected]> wrote:
(quoted diff) +1 -0
+			*nodes = node_memory_map;
 		else

node_states[N_MEMORY] ?

Review

Quoted 4 lines
(quoted diff) +1 -1
 		check_pgd_range(vma, vma->vm_start, vma->vm_end,
-				&node_online_map, MPOL_MF_STATS, md);
+				&node_memory_map, MPOL_MF_STATS, md);
 	}

Again here.

-Kame

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#7 lore raw

Re: [patch 11/12] Memoryless nodes: Fix GFP_THISNODE behavior

In reply to a message not in the archive

some nitpicks...

Review

Quoted 12 lines · On Tue, 10 Jul 2007 14:52:16 -0700 Christoph Lameter <[email protected]> wrote:
(quoted diff) +12 -0
+static void build_thisnode_zonelists(pg_data_t *pgdat)
+{
+	enum zone_type i;
+	int j;
+	struct zonelist *zonelist;
+
+	for (i = 0; i < MAX_NR_ZONES; i++) {
+		zonelist = pgdat->node_zonelists + MAX_NR_ZONES + i;
+ 		j = build_zonelists_node(pgdat, zonelist, 0, i);
+		zonelist->zones[j] = NULL;
+	}
+}

adding explanation as following is maybe good.
==
/*
* NUMA default zonelist is structured as
* [0....MAX_NR_ZONES) : allows fallbacks to other node for each GFP_MASK.
* [MAX_NR_ZONES...MAX_ZONELISTS) : disallow fallbacks for GFP_XXX |GFP_THISNODE */
==

Review static void build_zonelists(pg_data_t *p · line 2286

Quoted 11 lines
(quoted diff) +3 -1
+
+/*
  * Build zonelists ordered by zone and nodes within zones.
  * This results in conserving DMA zone[s] until all Normal memory is
  * exhausted, but results in overflowing to remote node while memory
@@ -2267,7 +2283,7 @@ static void build_zonelists(pg_data_t *p
 	int order = current_zonelist_order;
 
 	/* initialize zonelists */
-	for (i = 0; i < MAX_NR_ZONES; i++) {
+	for (i = 0; i < 2 * MAX_NR_ZONES; i++) {

please use MAX_ZONELISTS here.

-Kame

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#10 lore raw

Re: [patch 08/12] Uncached allocator: Handle memoryless nodes

In reply to a message not in the archive
Quoted 6 lines · Christoph Lameter

The checks for node_online in the uncached allocator are made to make sure that memory is available on these nodes. Thus switch all the checks to use the node_memory and for_each_memory_node functions.

I'm fine with this:

Jes

Quoted 33 lines
---
 arch/ia64/kernel/uncached.c |    4 ++--
 drivers/char/mspec.c        |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.22-rc6-mm1/arch/ia64/kernel/uncached.c
===================================================================

arch/ia64/kernel/uncached.c +2 -2
@@ -196,7 +196,7 @@ unsigned long uncached_alloc_page(int st
 	nid = starting_nid;
 
 	do {
-		if (!node_online(nid))
+		if (!node_state(nid, N_MEMORY))
 			continue;
 		uc_pool = &uncached_pools[nid];
 		if (uc_pool->pool == NULL)
@@ -268,7 +268,7 @@ static int __init uncached_init(void)
 {
 	int nid;
 
-	for_each_online_node(nid) {
+	for_each_node_state(nid, N_ONLINE) {
 		uncached_pools[nid].pool = gen_pool_create(PAGE_SHIFT, nid);
 		mutex_init(&uncached_pools[nid].add_chunk_mutex);
 	}

Index: linux-2.6.22-rc6-mm1/drivers/char/mspec.c
===================================================================

drivers/char/mspec.c mspec_init(void) · line 359

Quoted 8 lines
drivers/char/mspec.c +1 -1
@@ -353,7 +353,7 @@ mspec_init(void)
 		is_sn2 = 1;
 		if (is_shub2()) {
 			ret = -ENOMEM;
-			for_each_online_node(nid) {
+			for_each_node_state(nid, N_ONLINE) {
 				int actual_nid;
 				int nasid;
 				unsigned long phys;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
In reply to KAMEZAWA Hiroyuki
Quoted 8 lines · KAMEZAWA Hiroyuki

Review

Quoted 2 lines · On Tue, 10 Jul 2007 14:52:15 -0700 Christoph Lameter <[email protected]> wrote:
(quoted diff) +1 -0
+			*nodes = node_memory_map;
 		else

node_states[N_MEMORY] ?

Quoted 6 lines

Review

Quoted 4 lines
(quoted diff) +1 -1
 		check_pgd_range(vma, vma->vm_start, vma->vm_end,
-				&node_online_map, MPOL_MF_STATS, md);
+				&node_memory_map, MPOL_MF_STATS, md);
 	}

Again here.

I think Christoph missed a hunk in the node_memory_map patch, which would

#define node_memory_map node_stats[N_MEMORY]

Thanks,
Nish

Signature · 8 lines
Nishanth Aravamudan <[email protected]>
IBM Linux Technology Center

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#12 lore raw

Re: [patch 02/12] NUMA: Introduce node_memory_map

In reply to a message not in the archive
Quoted 7 lines · Christoph Lameter

It is necessary to know if nodes have memory since we have recently begun to add support for memoryless nodes. For that purpose we introduce a new node state N_MEMORY.

A node has its bit in node_memory_map set if it has memory. If a node has memory then it has at least one zone defined in its pgdat structure that is located in the pgdat itself.

Uh, except node_memory_map is not defined below.

I'm guessing you just need

#define node_memory_map node_states[N_MEMORY]

below.

Thanks,
Nish

Quoted 46 lines

N_MEMORY can then be used in various places to insure that we do the right thing when we encounter a memoryless node.

---
 include/linux/nodemask.h |    1 +
 mm/page_alloc.c          |    9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

Index: linux-2.6.22-rc6-mm1/include/linux/nodemask.h
===================================================================

include/linux/nodemask.h +1 -0
@@ -343,6 +343,7 @@ static inline void __nodes_remap(nodemas
 enum node_states {
 	N_POSSIBLE,	/* The node could become online at some point */
 	N_ONLINE,	/* The node is online */
+	N_MEMORY,	/* The node has memory */
 	NR_NODE_STATES
 };
 

Index: linux-2.6.22-rc6-mm1/mm/page_alloc.c
===================================================================

mm/page_alloc.c +7 -2
@@ -2392,8 +2392,13 @@ static int __build_all_zonelists(void *d
 	int nid;
 
 	for_each_online_node(nid) {
-		build_zonelists(NODE_DATA(nid));
-		build_zonelist_cache(NODE_DATA(nid));
+		pg_data_t *pgdat = NODE_DATA(nid);
+
+		build_zonelists(pgdat);
+		build_zonelist_cache(pgdat);
+
+		if (pgdat->node_present_pages)
+			node_set_state(nid, N_MEMORY);
 	}
 	return 0;
 }
Signature · 1 line
-- 
Signature · 8 lines
Nishanth Aravamudan <[email protected]>
IBM Linux Technology Center

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#4 lore raw
In reply to Nishanth Aravamudan
Quoted 16 lines · Nishanth Aravamudan
Quoted 8 lines · KAMEZAWA Hiroyuki

Review

Quoted 2 lines · On Tue, 10 Jul 2007 14:52:15 -0700 Christoph Lameter <[email protected]> wrote:
(quoted diff) +1 -0
+			*nodes = node_memory_map;
 		else

node_states[N_MEMORY] ?

Quoted 6 lines

Review

Quoted 4 lines
(quoted diff) +1 -1
 		check_pgd_range(vma, vma->vm_start, vma->vm_end,
-				&node_online_map, MPOL_MF_STATS, md);
+				&node_memory_map, MPOL_MF_STATS, md);
 	}

Again here.

Quoted 4 lines

I think Christoph missed a hunk in the node_memory_map patch, which would

#define node_memory_map node_stats[N_MEMORY]

Or maybe it's intentional -- and your changes are appropriate (and in-line with the other changes Christoph's patches made).

Thanks,
Nish

Signature · 8 lines
Nishanth Aravamudan <[email protected]>
IBM Linux Technology Center

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#5 lore raw
In reply to Nishanth Aravamudan
Quoted 4 lines · Nishanth Aravamudan

I think Christoph missed a hunk in the node_memory_map patch, which would

#define node_memory_map node_stats[N_MEMORY]

No. Somehow the patch was not updated. Need to send out a new rev.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#8 lore raw

Re: [patch 11/12] Memoryless nodes: Fix GFP_THISNODE behavior

In reply to KAMEZAWA Hiroyuki
Quoted 8 lines · KAMEZAWA Hiroyuki

Review

Quoted 8 lines
(quoted diff) +8 -0
+	struct zonelist *zonelist;
+
+	for (i = 0; i < MAX_NR_ZONES; i++) {
+		zonelist = pgdat->node_zonelists + MAX_NR_ZONES + i;
+ 		j = build_zonelists_node(pgdat, zonelist, 0, i);
+		zonelist->zones[j] = NULL;
+	}
+}
Quoted 8 lines

adding explanation as following is maybe good.
==
/*
* NUMA default zonelist is structured as
* [0....MAX_NR_ZONES) : allows fallbacks to other node for each GFP_MASK.
* [MAX_NR_ZONES...MAX_ZONELISTS) : disallow fallbacks for GFP_XXX |GFP_THISNODE */
==

Will add this.

Quoted 8 lines
Quoted 8 lines
(quoted diff) +2 -0
+
+/*
  * Build zonelists ordered by zone and nodes within zones.
  * This results in conserving DMA zone[s] until all Normal memory is
  * exhausted, but results in overflowing to remote node while memory
@@ -2267,7 +2283,7 @@ static void build_zonelists(pg_data_t *p
 	int order = current_zonelist_order;
 
Quoted 5 lines

Review static void build_zonelists(pg_data_t *p · line 2286

Quoted 3 lines
(quoted diff) +1 -1
 	/* initialize zonelists */
-	for (i = 0; i < MAX_NR_ZONES; i++) {
+	for (i = 0; i < 2 * MAX_NR_ZONES; i++) {

please use MAX_ZONELISTS here.

Right. Thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>