Skip to contentSkip to conversation

V4 ia64 SPARSEMEM - SPARSEMEM code

PATCH Dave Hansen 3 participants 6 messages Sep 22, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines · Bob Picco

This patch is the minimal set of changes required by ia64 to use SPARSEMEM.

I have a couple of little style comments.

Review

Quoted 13 lines
(quoted diff) +7 -0
+#ifdef CONFIG_SPARSEMEM
+	efi_memmap_walk(register_sparse_mem, NULL);
+#endif
+	sparse_init();
+
 	efi_memmap_walk(filter_rsvd_memory, count_node_pages);
 
+#ifdef CONFIG_VIRTUAL_MEM_MAP
 	vmalloc_end -= PAGE_ALIGN(max_low_pfn * sizeof(struct page));
 	vmem_map = (struct page *) vmalloc_end;
 	efi_memmap_walk(create_mem_map_page_table, NULL);
 	printk("Virtual mem_map starts at 0x%p\n", vmem_map);
+#endif

It would be nice if these kind of .c file #ifdefs could be broken out a little more. For instance, you could make an arch_sparse_init() that does all of the sparsemem bits, and make it a do{}while(0) when ! CONFIG_SPARSEMEM.

Review void __init paging_init(void) · line 727

Quoted 9 lines
(quoted diff) +2 -0
 	for_each_online_node(node) {
 		memset(zones_size, 0, sizeof(zones_size));
@@ -690,7 +722,9 @@ void __init paging_init(void)
 
 		pfn_offset = mem_data[node].min_pfn;
 
+#ifdef CONFIG_VIRTUAL_MEM_MAP
 		NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset;
+#endif

Is CONFIG_FLAT_NODE_MEM_MAP more appropriate here? That's how ->node_mem_map is #ifdef'd to begin with in mmzone.h.

arch/ia64/mm/numa.c paddr_to_nid(unsigned long paddr) · line 50

Quoted 10 lines
arch/ia64/mm/numa.c +2 -1
@@ -45,5 +45,30 @@ paddr_to_nid(unsigned long paddr)
 		    paddr < node_memblk[i].start_paddr + node_memblk[i].size)
 			break;
 
-	return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);
+	return (i < num_node_memblks) ?
+		node_memblk[i].nid : (num_node_memblks ? -1 : 0);
 }

Looks like just a whitespace change.

-- Dave

#1 lore raw

Re: [Lhms-devel] [PATCH 4/4] V4 ia64 SPARSEMEM - SPARSEMEM code changes

Quoted 7 lines · Dave Hansen

Review

Quoted 5 lines
(quoted diff) +2 -1
-	return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);
+	return (i < num_node_memblks) ?
+		node_memblk[i].nid : (num_node_memblks ? -1 : 0);
 }

Looks like just a whitespace change.

But really far less radical than it deserves ... nested conditional expressions? Come on. How about:

	if (i < num_node_memblks)
		return node_memblk[i].nid;
	if (num_node_memblks)
		return -1;
	return 0;
#2 lore raw

Re: [Lhms-devel] [PATCH 4/4] V4 ia64 SPARSEMEM - SPARSEMEM code changes

In reply to Dave Hansen

Dave Hansen wrote: [Thu Sep 22 2005, 12:36:16PM EDT]

Quoted 13 lines · Bob Picco
Quoted 2 lines

This patch is the minimal set of changes required by ia64 to use SPARSEMEM.

I have a couple of little style comments.

Quoted 7 lines
(quoted diff) +5 -0
+#ifdef CONFIG_SPARSEMEM
+	efi_memmap_walk(register_sparse_mem, NULL);
+#endif
+	sparse_init();
+
 	efi_memmap_walk(filter_rsvd_memory, count_node_pages);
Quoted 11 lines

Review

Quoted 6 lines
(quoted diff) +2 -0
+#ifdef CONFIG_VIRTUAL_MEM_MAP
 	vmalloc_end -= PAGE_ALIGN(max_low_pfn * sizeof(struct page));
 	vmem_map = (struct page *) vmalloc_end;
 	efi_memmap_walk(create_mem_map_page_table, NULL);
 	printk("Virtual mem_map starts at 0x%p\n", vmem_map);
+#endif

It would be nice if these kind of .c file #ifdefs could be broken out a little more. For instance, you could make an arch_sparse_init() that does all of the sparsemem bits, and make it a do{}while(0) when ! CONFIG_SPARSEMEM.

I could do this. It would eliminate one conditional. Eventually I'm hope for only SPARSEMEM but that is a ways off.

Quoted 5 lines
Quoted 5 lines
(quoted diff) +0 -0
 	for_each_online_node(node) {
 		memset(zones_size, 0, sizeof(zones_size));
@@ -690,7 +722,9 @@ void __init paging_init(void)
 
Quoted 8 lines

Review void __init paging_init(void) · line 727

Quoted 5 lines
(quoted diff) +2 -0
 		pfn_offset = mem_data[node].min_pfn;
 
+#ifdef CONFIG_VIRTUAL_MEM_MAP
 		NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset;
+#endif

Is CONFIG_FLAT_NODE_MEM_MAP more appropriate here? That's how ->node_mem_map is #ifdef'd to begin with in mmzone.h.

Well I think this is doable but probaably shouldn't. This code is very specific to CONFIG_VIRTUAL_MEM_MAP.

Quoted 7 lines
Quoted 7 lines
arch/ia64/mm/numa.c +0 -0
@@ -45,5 +45,30 @@ paddr_to_nid(unsigned long paddr)
 		    paddr < node_memblk[i].start_paddr + node_memblk[i].size)
 			break;
 
Quoted 6 lines

arch/ia64/mm/numa.c paddr_to_nid(unsigned long paddr) · line 50

Quoted 4 lines
arch/ia64/mm/numa.c +2 -1
-	return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);
+	return (i < num_node_memblks) ?
+		node_memblk[i].nid : (num_node_memblks ? -1 : 0);
 }

Looks like just a whitespace change.

Oh dam. This shouldn't have been introduced. It's not part of SPARSEMEM.

Quoted 2 lines

-- Dave

bob

Quoted 1 line
#3 lore raw

Re: [Lhms-devel] [PATCH 4/4] V4 ia64 SPARSEMEM - SPARSEMEM code changes

In reply to Dave Hansen

Matthew Wilcox wrote: [Thu Sep 22 2005, 01:13:40PM EDT]

Quoted 9 lines · Dave Hansen
Quoted 7 lines

Review

Quoted 5 lines
(quoted diff) +2 -1
-	return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);
+	return (i < num_node_memblks) ?
+		node_memblk[i].nid : (num_node_memblks ? -1 : 0);
 }

Looks like just a whitespace change.

Quoted 8 lines

But really far less radical than it deserves ... nested conditional expressions? Come on. How about:

	if (i < num_node_memblks)
		return node_memblk[i].nid;
	if (num_node_memblks)
		return -1;
	return 0;

Yup looks better. As I said to Dave, it shouldn't have been introduced. So this is a nice patch suggestion for clean up but later.

bob

#4 lore raw
In reply to Dave Hansen
Quoted 9 lines · Bob Picco
Quoted 6 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+#ifdef CONFIG_VIRTUAL_MEM_MAP
            NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset;
+#endif

Is CONFIG_FLAT_NODE_MEM_MAP more appropriate here? That's how ->node_mem_map is #ifdef'd to begin with in mmzone.h.

Well I think this is doable but probaably shouldn't. This code is very specific to CONFIG_VIRTUAL_MEM_MAP.

FLAT_NODE_MEM_MAP depends on only !SPARSEMEM, as does VIRTUAL_MEM_MAP. So, I guess they're functionally equivalent right now. It might be most nice to at least add a comment, saying that it actually depends on both.

-- Dave

#5 lore raw

Re: [Lhms-devel] [PATCH 4/4] V4 ia64 SPARSEMEM - SPARSEMEM code changes

In reply to Dave Hansen

Dave Hansen wrote: [Thu Sep 22 2005, 02:05:07PM EDT]

Quoted 11 lines · Bob Picco
Quoted 9 lines
Quoted 6 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+#ifdef CONFIG_VIRTUAL_MEM_MAP
            NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset;
+#endif

Is CONFIG_FLAT_NODE_MEM_MAP more appropriate here? That's how ->node_mem_map is #ifdef'd to begin with in mmzone.h.

Well I think this is doable but probaably shouldn't. This code is very specific to CONFIG_VIRTUAL_MEM_MAP.

Quoted 8 lines

FLAT_NODE_MEM_MAP depends on only !SPARSEMEM, as does VIRTUAL_MEM_MAP. So, I guess they're functionally equivalent right now. It might be most nice to at least add a comment, saying that it actually depends on both.

-- Dave

Okay. I'll add a comment before VIRTUAL_MEM_MAP in Kconfig file. That will cover all uses of VIRTUAL_MEM_MAP.

thanks,

bob