Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1E03tr-0002oa-B0 for mharc-grub-devel@gnu.org; Tue, 02 Aug 2005 17:02:11 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E03tA-0002aj-GM for grub-devel@gnu.org; Tue, 02 Aug 2005 17:01:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E03sq-0002PQ-W4 for grub-devel@gnu.org; Tue, 02 Aug 2005 17:01:19 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E03sl-0002Jq-C6 for grub-devel@gnu.org; Tue, 02 Aug 2005 17:01:03 -0400 Received: from [212.43.237.68] (helo=kotoba.storever.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1E03mm-0003L2-1S for grub-devel@gnu.org; Tue, 02 Aug 2005 16:54:52 -0400 Received: from ASSP-nospam (localhost [127.0.0.1]) by kotoba.storever.com (Postfix) with ESMTP id 776F811ED6365 for ; Tue, 2 Aug 2005 22:42:00 +0200 (CEST) Received: from 127.0.0.1 ([127.0.0.1] helo=ip6-localhost) by ASSP-nospam ; 2 Aug 05 20:41:59 -0000 From: "Yoshinori K. Okuji" Organization: enbug.org To: The development of GRUB 2 Date: Tue, 2 Aug 2005 22:41:16 +0200 User-Agent: KMail/1.7.2 References: <42EF862F.1080306@inma.ucl.ac.be> <42EF9CFB.7040804@yahoo.fr> In-Reply-To: <42EF9CFB.7040804@yahoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508022241.16966.okuji@enbug.org> Subject: Re: doc on memory management X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2005 21:02:10 -0000 On Tuesday 02 August 2005 18:19, Vincent Pelletier wrote: > I wonder why the region header contains, to me, a useless field : addr. It is useful when debugging the code. > I see a light improvement in grub_mm_init_region : > /* If this region is too small, ignore it. */ > if (size < GRUB_MM_ALIGN * 2) > return; > If the region is 2*GRUB_MM_ALIGN, we can put a grub_mm_header_t plus a > grub_mm_region_t, and it would be full. Maybe adding 1 byte (or more) > might make more sense (but has it any practical impact...). That check is put only to avoid a strange error. > My realloc implementation handled the case where the realloc'ed block > had enough space after to expand. I might send a patch for this someday > if anyone finds it interesting to add. I'm not sure if it is really meaningful. Only if you can prove that your implementation improves something (such as memory efficiency), I will incorporate it. > I also implemented a memory defrag that merges successive free chunks in > one bigger. Although it relied on the fact both alloc'ed and free chucks > are known I think it can be adapted (if h->next != h+h->size*16, don't > merge h and h->next) and even a bit faster (as we only see free chunks). The current implementation merges free regions. What is bad? Okuji