lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 10 May 2010 17:29:17 +1000
From:	Benjamin Herrenschmidt <benh@...nel.crashing.org>
To:	Yinghai Lu <yinghai@...nel.org>
Cc:	Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Miller <davem@...emloft.net>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Johannes Weiner <hannes@...xchg.org>,
	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
	Jan Beulich <jbeulich@...ell.com>
Subject: Re: [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,
seriously.

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.

Cheers,
Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ