login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
May
»
5
Re: [RFC 0/2] Rootmem: boot-time memory allocator
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From: Johannes Weiner
Subject:
Re: [RFC 0/2] Rootmem: boot-time memory allocator
Date: Monday, May 5, 2008 - 3:58 am
Hi Yinghai, "Yinghai Lu" <yhlu.kernel@gmail.com> writes:
quoted text
> On Sun, May 4, 2008 at 8:34 AM, Johannes Weiner <hannes@saeurebad.de> wrote: >> >> Hi, >> >> Johannes Weiner <hannes@saeurebad.de> writes: >> >> > Hi Yinghai, >> > >> > Johannes Weiner <hannes@saeurebad.de> writes: >> > >> >> Hi, >> >> >> >> "Yinghai Lu" <yhlu.kernel@gmail.com> writes: >> >> >> >>> On Sat, May 3, 2008 at 10:54 AM, Ingo Molnar <mingo@elte.hu> wrote: >> >>>> >> >>>> * Johannes Weiner <hannes@saeurebad.de> wrote: >> >>>> >> >>>> > I was spending some time and work on the bootmem allocator the last >> >>>> > few weeks and came to the conclusion that its current design is not >> >>>> > appropriate anymore. >> >>>> > >> >>>> > As Ingo said in another email, NUMA technologies will become weirder, >> >>>> > nodes whose PFNs span other nodes for example and it makes bootmem >> >>>> > code become an unreadable mess. >> >>>> > >> >>>> > So I sat down two days ago and rewrote the allocator, here is the >> >>>> > result: rootmem! >> >>>> >> >>>> hehe :-) >> >>>> >> >>>> >> >>>> > The biggest difference to the old design is that there is only one >> >>>> > bitmap for all PFNs of all nodes together, so the overlapping PFN >> >>>> > problems simply dissolve and fun like allocations crossing node >> >>>> > boundaries work implicitely. The new API requires every node used by >> >>>> > the allocator to be registered and after that the bitmap gets >> >>>> > allocated and the allocator enabled. >> >>>> > >> >>>> > I chose to add a new allocator rather than replacing bootmem at once >> >>>> > because that would have required all callsites to switch in one go, >> >>>> > which would be a lot. The new allocator can be adopted more slowly >> >>>> > and I added a compatibility API for everything besides actually >> >>>> > setting up the allocator. When the last user dies, bootmem can be >> >>>> > dropped completely (including pgdat->bdata, whee..) >> >>>> > >> >>>> > The main ideas from bootmem have been stolen^W preserved but the new >> >>>> > design allowed me to shrink the code a lot and express things more >> >>>> > simple and clear: >> >>>> > >> >>>> > $ sloc.awk < mm/bootmem.c >> >>>> > 455 lines of code, 65 lines of comments (520 lines total) >> >>>> > >> >>>> > $ sloc.awk < mm/rootmem.c >> >>>> > 243 lines of code, 96 lines of comments (339 lines total) >> >>>> >> >>>> amazing! >> >>>> >> >>>> i'd still suggest to keep it all named bootmem though :-/ How about >> >>>> bootmem2.c and then renaming it back to bootmem.c, once the last user is >> >>>> gone? That would save people from having to rename whole chapters in >> >>>> entire books ;-) >> >>> >> >>> for spanning support node0:0-2g, 4-6g; node1: 2-4g, 6-8g, could have >> >>> some problem. >> >> >> >> Could you eleborate on that? >> >> >> >>> +/* >> >>> + * rootmem_register_node - register a node to rootmem >> >>> + * @nid: node id >> >>> + * @start: first pfn on the node >> >>> + * @end: first pfn after the node >> >>> + * >> >>> + * This function must not be called anymore if the allocator >> >>> + * is already up and running (rootmem_setup() has been called). >> >>> + */ >> >>> +void __init rootmem_register_node(int nid, unsigned long start, >> >>> + unsigned long end) >> >>> +{ >> >>> + BUG_ON(rootmem_functional); >> >>> + >> >>> + if (start < rootmem_min_pfn) >> >>> + rootmem_min_pfn = start; >> >>> + if (end > rootmem_max_pfn) >> >>> + rootmem_max_pfn = end; >> >>> + >> >>> + rootmem_node_pages[nid] = end - start; >> >>> + rootmem_node_offsets[nid] = start; >> >>> + rootmem_nr_nodes++; >> >>> +} >> >>> >> >>> could change rootmem_node_pages/offsets to be struct array with >> >>> offset, pages, and nid. and every node could several struct. and whole >> >>> array should be sorted with nid. >> >> In the long term, this would have to be implemented no matter if >> rootmem/bootmem2 gets merged or not, because bootmem suffers the same >> problem, right? >> >> >> >> The whole point is to be agnostic about weird NUMA configs. Right now, >> >> I am pretty proud of the simple data structures and I would avoid >> >> blowing them up again unless there is a hard reason to do so. >> >> This is non-helping crap, please excuse me. >> >> >> > One thing I have found is that __rootmem_alloc_node can not garuantee >> > that the memory it returns is on the requested node right now. >> >> Hm, we have two choices: Either we introduce a new API that requests the >> arch code to register not only node ranges but also subranges on that >> node, or we won't garuantee that you get all memory on the node you >> specified. Correct? >> >> The first option would be what you have proposed, I think. > > 1. current bootmem, add not_used_map to bdata. > 2. or in bootmem2, use pages_offset struct for every range... so one > node could have several ranges.
I think I found a solution, please have a look at the bootmem2 patches (coming soon). Hannes --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[RFC 0/2] Rootmem: boot-time memory allocator
, Johannes Weiner
, (Sat May 3, 8:25 am)
Re: [RFC 0/2] Rootmem: boot-time memory allocator
, Ingo Molnar
, (Sat May 3, 10:54 am)
Re: [RFC 0/2] Rootmem: boot-time memory allocator
, Yinghai Lu
, (Sat May 3, 9:06 pm)
Re: [RFC 0/2] Rootmem: boot-time memory allocator
, Johannes Weiner
, (Sun May 4, 1:54 am)
Re: [RFC 0/2] Rootmem: boot-time memory allocator
, Johannes Weiner
, (Sun May 4, 1:57 am)
Re: [RFC 0/2] Rootmem: boot-time memory allocator
, Johannes Weiner
, (Sun May 4, 7:17 am)
Re: [RFC 0/2] Rootmem: boot-time memory allocator
, Johannes Weiner
, (Sun May 4, 8:34 am)
Re: [RFC 0/2] Rootmem: boot-time memory allocator
, Yinghai Lu
, (Sun May 4, 11:44 am)
Re: [RFC 0/2] Rootmem: boot-time memory allocator
, Johannes Weiner
, (Mon May 5, 3:58 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
David Howells
[PATCH] KEYS: Use the variable 'key' in keyctl_describe_key()
Dave Jones
Re: OT: character encodings (was: Linux 2.6.20-rc4)
Greg Kroah-Hartman
[PATCH 17/36] sysdev: detect multiple driver registrations
Sam Ravnborg
Re: [PATCH] kbuild: fix make V=1
Nick Piggin
Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
git
:
Stephen R. van den Berg
Re: [RFC] origin link for cherry-pick and revert
Junio C Hamano
Re: [PATCH 1/2] Teach git-describe to display distances from tags.
Johannes Schindelin
Re: [PATCH 2/2] git-svn: support fetch with autocrlf on
Junio C Hamano
Re: [PATCH 6/6] Teach core object handling functions about gitlinks
Michael S. Tsirkin
git-kill: rewrite history removing a commit
linux-netdev
:
Jarek Poplawski
Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event...
Lennert Buytenhek
Re: Distributed Switch Architecture(DSA)
Daniel Schaffrath
Re: tcp bw in 2.6
Matt Mackall
Re: [regression] nf_iterate(), BUG: unable to handle kernel NULL pointer dereference
Guo-Fu Tseng
Re: jme: UDP checksum error, and lots of them
openbsd-misc
:
Claudio Jeker
Re: Vlan Tag on Vlan Tag (l2tunneling)
Josh Grosse
ssh/sshd challenge-response seems to have stopped working in -current
Pieter Verberne
File collision while using pkg_add
Tomas Bodzar
bsd: uvm_mapent_alloc: out of static map entries
Community First Financial
Teacher A+ Loan
git-commits-head
:
Linux Kernel Mailing List
ath9k: Added get_survey callback in order to get channel noise
Linux Kernel Mailing List
tracing: protect reader of cmdline output
Linux Kernel Mailing List
kconfig: recalc symbol value before showing search results
Linux Kernel Mailing List
KVM: VMX: Clear CR4.VMXE in hardware_disable
Linux Kernel Mailing List
USB: set correct configuration in probe of ti_usb_3410_5052
Colocation donated by:
Syndicate