- patches.fixes/patch-2.6.11-rc1: 2.6.11-rc1.
[linux-flexiantxendom0-3.2.10.git] / mm / bootmem.c
index 5e2dce4..260e703 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <asm/dma.h>
 #include <asm/io.h>
+#include "internal.h"
 
 /*
  * Access to this subsystem has to be serialized externally. (this is
@@ -275,17 +276,18 @@ static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat)
        for (i = 0; i < idx; ) {
                unsigned long v = ~map[i / BITS_PER_LONG];
                if (gofast && v == ~0UL) {
-                       int j;
+                       int j, order;
 
                        count += BITS_PER_LONG;
                        __ClearPageReserved(page);
-                       set_page_count(page, 1);
+                       order = ffs(BITS_PER_LONG) - 1;
+                       set_page_refs(page, order);
                        for (j = 1; j < BITS_PER_LONG; j++) {
                                if (j + 16 < BITS_PER_LONG)
                                        prefetchw(page + j + 16);
                                __ClearPageReserved(page + j);
                        }
-                       __free_pages(page, ffs(BITS_PER_LONG)-1);
+                       __free_pages(page, order);
                        i += BITS_PER_LONG;
                        page += BITS_PER_LONG;
                } else if (v) {
@@ -294,7 +296,7 @@ static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat)
                                if (v & m) {
                                        count++;
                                        __ClearPageReserved(page);
-                                       set_page_count(page, 1);
+                                       set_page_refs(page, 0);
                                        __free_page(page);
                                }
                        }