]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
bootmem: revisit bootmem descriptor list handling
authorJohannes Weiner <hannes@saeurebad.de>
Thu, 24 Jul 2008 04:28:03 +0000 (21:28 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Jul 2008 17:47:20 +0000 (10:47 -0700)
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>
mm/bootmem.c

index 484849bfc8c43032cbd8641519f3e6d10dae6876..9da7d40978109f566986f0702f5359fcb0f16ba6 100644 (file)
@@ -23,7 +23,6 @@ unsigned long max_low_pfn;
 unsigned long min_low_pfn;
 unsigned long max_pfn;
 
-static LIST_HEAD(bdata_list);
 #ifdef CONFIG_CRASH_DUMP
 /*
  * 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;
 
 bootmem_data_t bootmem_node_data[MAX_NUMNODES] __initdata;
 
+static struct list_head bdata_list __initdata = LIST_HEAD_INIT(bdata_list);
+
 static int bootmem_debug;
 
 static int __init bootmem_debug_setup(char *buf)
@@ -73,20 +74,16 @@ unsigned long __init bootmem_bootmap_pages(unsigned long pages)
  */
 static void __init link_bootmem(bootmem_data_t *bdata)
 {
-       bootmem_data_t *ent;
+       struct list_head *iter;
 
-       if (list_empty(&bdata_list)) {
-               list_add(&bdata->list, &bdata_list);
-               return;
-       }
-       /* insert in order */
-       list_for_each_entry(ent, &bdata_list, list) {
-               if (bdata->node_boot_start < ent->node_boot_start) {
-                       list_add_tail(&bdata->list, &ent->list);
-                       return;
-               }
+       list_for_each(iter, &bdata_list) {
+               bootmem_data_t *ent;
+
+               ent = list_entry(iter, bootmem_data_t, list);
+               if (bdata->node_boot_start < ent->node_boot_start)
+                       break;
        }
-       list_add_tail(&bdata->list, &bdata_list);
+       list_add_tail(&bdata->list, iter);
 }
 
 /*