diff options
Diffstat (limited to 'mm/bootmem.c')
-rw-r--r-- | mm/bootmem.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c index f82f7aebbee3..c1330cc19783 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -33,6 +33,14 @@ EXPORT_SYMBOL(max_pfn); /* This is exported so | |||
33 | * dma_get_required_mask(), which uses | 33 | * dma_get_required_mask(), which uses |
34 | * it, can be an inline function */ | 34 | * it, can be an inline function */ |
35 | 35 | ||
36 | #ifdef CONFIG_CRASH_DUMP | ||
37 | /* | ||
38 | * If we have booted due to a crash, max_pfn will be a very low value. We need | ||
39 | * to know the amount of memory that the previous kernel used. | ||
40 | */ | ||
41 | unsigned long saved_max_pfn; | ||
42 | #endif | ||
43 | |||
36 | /* return the number of _pages_ that will be allocated for the boot bitmap */ | 44 | /* return the number of _pages_ that will be allocated for the boot bitmap */ |
37 | unsigned long __init bootmem_bootmap_pages (unsigned long pages) | 45 | unsigned long __init bootmem_bootmap_pages (unsigned long pages) |
38 | { | 46 | { |
@@ -57,7 +65,7 @@ static unsigned long __init init_bootmem_core (pg_data_t *pgdat, | |||
57 | pgdat->pgdat_next = pgdat_list; | 65 | pgdat->pgdat_next = pgdat_list; |
58 | pgdat_list = pgdat; | 66 | pgdat_list = pgdat; |
59 | 67 | ||
60 | mapsize = (mapsize + (sizeof(long) - 1UL)) & ~(sizeof(long) - 1UL); | 68 | mapsize = ALIGN(mapsize, sizeof(long)); |
61 | bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT); | 69 | bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT); |
62 | bdata->node_boot_start = (start << PAGE_SHIFT); | 70 | bdata->node_boot_start = (start << PAGE_SHIFT); |
63 | bdata->node_low_pfn = end; | 71 | bdata->node_low_pfn = end; |
@@ -178,7 +186,7 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size, | |||
178 | } else | 186 | } else |
179 | preferred = 0; | 187 | preferred = 0; |
180 | 188 | ||
181 | preferred = ((preferred + align - 1) & ~(align - 1)) >> PAGE_SHIFT; | 189 | preferred = ALIGN(preferred, align) >> PAGE_SHIFT; |
182 | preferred += offset; | 190 | preferred += offset; |
183 | areasize = (size+PAGE_SIZE-1)/PAGE_SIZE; | 191 | areasize = (size+PAGE_SIZE-1)/PAGE_SIZE; |
184 | incr = align >> PAGE_SHIFT ? : 1; | 192 | incr = align >> PAGE_SHIFT ? : 1; |
@@ -219,7 +227,7 @@ found: | |||
219 | */ | 227 | */ |
220 | if (align < PAGE_SIZE && | 228 | if (align < PAGE_SIZE && |
221 | bdata->last_offset && bdata->last_pos+1 == start) { | 229 | bdata->last_offset && bdata->last_pos+1 == start) { |
222 | offset = (bdata->last_offset+align-1) & ~(align-1); | 230 | offset = ALIGN(bdata->last_offset, align); |
223 | BUG_ON(offset > PAGE_SIZE); | 231 | BUG_ON(offset > PAGE_SIZE); |
224 | remaining_size = PAGE_SIZE-offset; | 232 | remaining_size = PAGE_SIZE-offset; |
225 | if (size < remaining_size) { | 233 | if (size < remaining_size) { |