From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yinghai Lu Subject: Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy Date: Tue, 23 Mar 2010 22:54:00 -0700 Message-ID: <4BA9A8F8.5070206@kernel.org> References: <4BA7EE72.7000507@kernel.org> <4BA80019.5000900@kernel.org> <4BA813A4.1010704@kernel.org> <4BA8594F.8090205@kernel.org> <20100323080252.GA4848@elte.hu> <4BA883C0.2070102@kernel.org> <20100323094834.GB4576@elte.hu> <1269404982.8599.148.camel@pasglop> <1269405882.8599.155.camel@pasglop> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: Received: from hera.kernel.org ([140.211.167.34]:54859 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752141Ab0CXF4N (ORCPT ); Wed, 24 Mar 2010 01:56:13 -0400 In-Reply-To: <1269405882.8599.155.camel@pasglop> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Benjamin Herrenschmidt Cc: Ingo Molnar , Thomas Gleixner , David Miller , Andrew Morton , Linus Torvalds , hpa@zytor.com, jbarnes@virtuousgeek.org, ebiederm@xmission.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org On 03/23/2010 09:44 PM, Benjamin Herrenschmidt wrote: > >> I though one possibility would be to have LMB regions become more lists >> than arrays, so that the static storage only needs to cover as much as >> is needed during really early boot (and we could probably still move the >> BSS top point on some archs to dynamically make more ... actually we >> could be smart arses and use LMB to allocate more LMB list heads if we >> are reaching the table limit :-) > > Actually what about that: > > LMB entries are linked-listed. The array is just storage for those entry > "heads". > > The initial static array only needs to be big enough for very very early > platform specific kernel bits and pieces, so it could even be sized by a > Kconfig option. Or it could just use a klimit moving trick to pick up a > page right after the BSS but that may need to be arch specific. > > lmb_init() queues all the entries from the initial array in a freelist > > lmb_alloc() and lmb_reserve() just pop entries from that freelist to > populate the two main linked lists (memory and reserved). > > When something tries to dequeue up the last freelist entry, then under > the hood, LMB uses it instead to allocate a new block of LMB entries > that gets added to the freelist. > > We never free blocks of LMB entries. > > That way, we can fine tine the static array to be as small as we can > realistically make it be, and we have no boundary limitations on the > amount of entries in either the memory list or the reserved list. > > I'm a bit too flat out right now to write code, but if there's no > objection, I might give that a go either later this week or next week, > see if I can replace bootmem on powerpc. > if the array can be doubled and have old one copied to new one. then we don't change lmb.c too much. new early_res.c exend lmb. and another half already works with x86 to replace bootmem. will check if i can produce one patch to make powerpc to reuse early_res/nobootmem Thanks Yinghai