[lkml]   [2010]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 08/22] lmb: Add get_free_all_memory_range()
On Sat, 2010-05-08 at 08:17 -0700, Yinghai Lu wrote:
> get_free_all_memory_range is for CONFIG_NO_BOOTMEM=y, and will be called by
> free_all_memory_core_early().
> It will use early_node_map aka active ranges subtract lmb.reserved to
> get all free range, and those ranges will convert to slab pages.

Ok, so after looking more, and more or less understanding the very
convoluted code path you have created there:

You basically end up calling into lmb to create that "range" array of
ranges that represent the overlap of LMB's with a node ranges.

That itself is done by LMB itself calling into page_alloc.c which
creates a struct range array of all the node ranges, LMB then does the
intersection, sorts it, returns that to bootmem, which can finally
iterate that, do the free's and discard it.

Wow !

All of that could fit in one single function, inside or outside LMB (I
vote for outside for now, since it's all about NO_BOOTMEM).

Do like I do for my nid allocator: Call get_pfn_range_for_nid(),
then walk the LMB array and pick up intersecting ranges & free them.
Easy. One function, not 3 layers spread as many files, no need to
allocate that range array thing etc...

BTW. You -really- need to get rid of that kernel/range.c and associated
range.h. We don't need -yet-another- range management system in Linux,

So all that stuff goes out of LMB for now. Just rebase your shit on top
of my patches when I post them, use my new for_each_lmb() along with
get_pfn_range_for_nid() as explained above, and do that inside bootmem.c
for now.

Note that the entire NO_BOOTMEM should be a sparate file. Call it
bootmem-lmb.c and make it CONFIG_BOOTMEM_LMB or something like that to
make it clear that it depends on ARCH_HAVE_LMB.

You should be able to remove a ton of crap code with that.


 \ /
  Last update: 2010-05-10 09:33    [W:0.189 / U:6.772 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site