diff options
author | Johannes Weiner <hannes@saeurebad.de> | 2008-07-24 00:28:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 13:47:20 -0400 |
commit | 636cc40cb79f511d9caa27ef098a83e4fa4971fb (patch) | |
tree | c1090aa1a56bfc1ddb3de2f17447b98c20515646 | |
parent | df049a5f41a3b2eee2131221959e3b558ba7c705 (diff) |
bootmem: revisit bootmem descriptor list handling
link_bootmem handles an insertion of a new descriptor into the sorted list
in more or less three explicit branches; empty list, insert in between and
append. These cases can be expressed implicite.
Also mark the sorted list as initdata as it can be thrown away after boot
as well.
Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/bootmem.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c index 484849bfc8c4..9da7d4097810 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -23,7 +23,6 @@ unsigned long max_low_pfn; | |||
23 | unsigned long min_low_pfn; | 23 | unsigned long min_low_pfn; |
24 | unsigned long max_pfn; | 24 | unsigned long max_pfn; |
25 | 25 | ||
26 | static LIST_HEAD(bdata_list); | ||
27 | #ifdef CONFIG_CRASH_DUMP | 26 | #ifdef CONFIG_CRASH_DUMP |
28 | /* | 27 | /* |
29 | * If we have booted due to a crash, max_pfn will be a very low value. We need | 28 | * If we have booted due to a crash, max_pfn will be a very low value. We need |
@@ -34,6 +33,8 @@ unsigned long saved_max_pfn; | |||
34 | 33 | ||
35 | bootmem_data_t bootmem_node_data[MAX_NUMNODES] __initdata; | 34 | bootmem_data_t bootmem_node_data[MAX_NUMNODES] __initdata; |
36 | 35 | ||
36 | static struct list_head bdata_list __initdata = LIST_HEAD_INIT(bdata_list); | ||
37 | |||
37 | static int bootmem_debug; | 38 | static int bootmem_debug; |
38 | 39 | ||
39 | static int __init bootmem_debug_setup(char *buf) | 40 | static int __init bootmem_debug_setup(char *buf) |
@@ -73,20 +74,16 @@ unsigned long __init bootmem_bootmap_pages(unsigned long pages) | |||
73 | */ | 74 | */ |
74 | static void __init link_bootmem(bootmem_data_t *bdata) | 75 | static void __init link_bootmem(bootmem_data_t *bdata) |
75 | { | 76 | { |
76 | bootmem_data_t *ent; | 77 | struct list_head *iter; |
77 | 78 | ||
78 | if (list_empty(&bdata_list)) { | 79 | list_for_each(iter, &bdata_list) { |
79 | list_add(&bdata->list, &bdata_list); | 80 | bootmem_data_t *ent; |
80 | return; | 81 | |
81 | } | 82 | ent = list_entry(iter, bootmem_data_t, list); |
82 | /* insert in order */ | 83 | if (bdata->node_boot_start < ent->node_boot_start) |
83 | list_for_each_entry(ent, &bdata_list, list) { | 84 | break; |
84 | if (bdata->node_boot_start < ent->node_boot_start) { | ||
85 | list_add_tail(&bdata->list, &ent->list); | ||
86 | return; | ||
87 | } | ||
88 | } | 85 | } |
89 | list_add_tail(&bdata->list, &bdata_list); | 86 | list_add_tail(&bdata->list, iter); |
90 | } | 87 | } |
91 | 88 | ||
92 | /* | 89 | /* |