public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [RFC] bootmem for 2.5
Date: Fri, 2 Nov 2001 19:31:54 -0800	[thread overview]
Message-ID: <20011102193154.B18699@holomorphy.com> (raw)
In-Reply-To: <20011102140207.V31822@w-wli.des.beaverton.ibm.com>
In-Reply-To: <20011102140207.V31822@w-wli.des.beaverton.ibm.com>; from willir@us.ibm.com on Fri, Nov 02, 2001 at 02:02:07PM -0800

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

  reply	other threads:[~2001-11-03  3:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-02 22:02 [RFC] bootmem for 2.5 William Irwin
2001-11-03  3:31 ` William Lee Irwin III [this message]
     [not found] ` <20011102214308.A8217@kroah.com>
2001-11-03 19:58   ` William Lee Irwin III
2001-11-06  3:23 ` Robert Love
2001-11-06  4:10   ` William Lee Irwin III
2001-11-08  0:44   ` William Lee Irwin III
2001-11-08  2:06     ` Robert Love
2001-11-09  0:27       ` William Lee Irwin III
2001-12-15  6:05 ` Ingo Molnar
2001-12-15 13:27   ` William Lee Irwin III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011102193154.B18699@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox