From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Dzzhp-0005e3-62 for mharc-grub-devel@gnu.org; Tue, 02 Aug 2005 12:33:29 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dzzhf-0005Z5-PE for grub-devel@gnu.org; Tue, 02 Aug 2005 12:33:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DzzhW-0005Uo-9o for grub-devel@gnu.org; Tue, 02 Aug 2005 12:33:18 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DzzhV-0005ME-HA for grub-devel@gnu.org; Tue, 02 Aug 2005 12:33:09 -0400 Received: from [217.12.11.36] (helo=smtp005.mail.ukl.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.34) id 1DzzcQ-0001I6-On for grub-devel@gnu.org; Tue, 02 Aug 2005 12:27:55 -0400 Received: (qmail 7759 invoked from network); 2 Aug 2005 16:15:07 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:Subject:References:In-Reply-To:X-Enigmail-Version:Content-Type:Content-Transfer-Encoding; b=2LscPiBLqTuj/Kdxkh/nePjxppxEmebw7JzdJKG6u3dAcKmn3mAYG9XeFzjRsak72WGequAu8ijEW7wc/z529eWLnDbei/sxtIejGusGXwxWCPN8V1aKeM4dk91JgzwcWxwqkuuHJx2UUR2cqWhi1CxVIuUW+cvzb54TDYhrOiM= ; Received: from unknown (HELO ?192.168.0.2?) (subdino2004@83.194.175.196 with plain) by smtp005.mail.ukl.yahoo.com with SMTP; 2 Aug 2005 16:15:06 -0000 Message-ID: <42EF9CFB.7040804@yahoo.fr> Date: Tue, 02 Aug 2005 18:19:07 +0200 From: Vincent Pelletier User-Agent: Debian Thunderbird 1.0.6 (X11/20050801) X-Accept-Language: en-us, en MIME-Version: 1.0 To: The development of GRUB 2 References: <42EF862F.1080306@inma.ucl.ac.be> In-Reply-To: <42EF862F.1080306@inma.ucl.ac.be> X-Enigmail-Version: 0.92.0.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 16:33:23 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Vincent Guffens wrote: > I have written some doc about mm in grub2. Nice work, explained with nice and clear schematics. Now I understand that piece of code :). I had trouble understanding : the macro you explain in "Allocation memory" the reason why the first free chunk of the ring is sometime moved the reason why alloc'ed chunks were removed from the list I wonder why the region header contains, to me, a useless field : addr. It is only set in grub_mm_init_region, invariably to the first header which is invariably at the same offset from the region beginning, defined by GRUB_MM_ALIGN. I don't think loosing sizeof(int) bytes is critical, though, as it would be padded anyway. It only made my comprehension of what's going on a little harder :). 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...). 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 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). Vincent Pelletier -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFC75z7FEQoKRQyjtURAla2AJ9SZk9V8RSHhDHm0hajC5uOA+f28wCglptX mpVBwRDWdcPc+uAxuSvJcWA= =1Sd1 -----END PGP SIGNATURE----- ___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com