Re: [RFC] bootmem for 2.5

From: William Lee Irwin III (wli@holomorphy.com)
Date: Fri Nov 02 2001 - 22:31:54 EST


On Fri, Nov 02, 2001 at 02:02:07PM -0800, William Irwin wrote:
> A number of people have expressed a wish to replace the bitmap-based
> bootmem allocator with one that tracks ranges explicitly. I have
> written such a replacement in order to deal with some of the situations
> I have encountered.

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/



This archive was generated by hypermail 2b29 : Wed Nov 07 2001 - 21:00:20 EST