My apologies, I found a logic error in free_all_bootmem_core() which
was not triggered during testing, but deserves correction, in addition
to a leak introduced during verbosity reduction. Without
CONFIG_KERNEL_HACKING the segment pool would be leaked, and also
free_bootmem_core() may invalidate the value of
pgdat->bdata->segment_tree.length_tree read prior to calling it.
This fix was tested on i386.
--- linux.wrong/mm/bootmem.c Fri Nov 2 19:11:41 2001
+++ linux/mm/bootmem.c Fri Nov 2 19:12:23 2001
@@ -659,23 +659,25 @@
unsigned long total = 0UL, mapstart, start, end;
unsigned long node_start = pgdat->bdata->node_boot_start >> PAGE_SHIFT;
struct page *page;
- treap_node_t *parent, *tmp = pgdat->bdata->segment_tree.length_tree;
+ treap_node_t *parent, *tmp;
mapstart = virt_to_phys(pgdat->bdata->node_bootmem_map);
#ifdef CONFIG_KERNEL_HACKING
printk("Available physical memory:\n");
- free_bootmem_core(pgdat->bdata, mapstart,
- RND_UP(NR_SEGMENTS*sizeof(segment_buf_t), PAGE_SIZE));
#endif /* CONFIG_KERNEL_HACKING */
+ free_bootmem_core(pgdat->bdata, mapstart,
+ RND_UP(NR_SEGMENTS*sizeof(segment_buf_t), PAGE_SIZE));
+
/*
* Destructive post-order traversal of the length tree.
* The tree is never used again, so no attempt is made
* to restore it to working order.
*/
+ tmp = pgdat->bdata->segment_tree.length_tree;
treap_find_leftmost_leaf(tmp);
while(tmp) {
segment_tree_node_t *segment = length_segment_treap(tmp);
Cheers,
Bill
-----------------
willir@us.ibm.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/