diff options
-rw-r--r-- | include/linux/bootmem.h | 42 | ||||
-rw-r--r-- | mm/bootmem.c | 28 |
2 files changed, 47 insertions, 23 deletions
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index fa2523f47628..1e8dddfb3083 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -44,18 +44,24 @@ typedef struct bootmem_data { | |||
44 | extern unsigned long bootmem_bootmap_pages (unsigned long); | 44 | extern unsigned long bootmem_bootmap_pages (unsigned long); |
45 | extern unsigned long init_bootmem (unsigned long addr, unsigned long memend); | 45 | extern unsigned long init_bootmem (unsigned long addr, unsigned long memend); |
46 | extern void free_bootmem (unsigned long addr, unsigned long size); | 46 | extern void free_bootmem (unsigned long addr, unsigned long size); |
47 | extern void * __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal); | 47 | extern void * __alloc_bootmem (unsigned long size, |
48 | extern void * __alloc_bootmem_nopanic (unsigned long size, unsigned long align, unsigned long goal); | 48 | unsigned long align, |
49 | unsigned long goal); | ||
50 | extern void * __alloc_bootmem_nopanic (unsigned long size, | ||
51 | unsigned long align, | ||
52 | unsigned long goal); | ||
49 | extern void * __alloc_bootmem_low(unsigned long size, | 53 | extern void * __alloc_bootmem_low(unsigned long size, |
50 | unsigned long align, | 54 | unsigned long align, |
51 | unsigned long goal); | 55 | unsigned long goal); |
52 | extern void * __alloc_bootmem_low_node(pg_data_t *pgdat, | 56 | extern void * __alloc_bootmem_low_node(pg_data_t *pgdat, |
53 | unsigned long size, | 57 | unsigned long size, |
54 | unsigned long align, | 58 | unsigned long align, |
55 | unsigned long goal); | 59 | unsigned long goal); |
56 | extern void * __alloc_bootmem_core(struct bootmem_data *bdata, | 60 | extern void * __alloc_bootmem_core(struct bootmem_data *bdata, |
57 | unsigned long size, unsigned long align, unsigned long goal, | 61 | unsigned long size, |
58 | unsigned long limit); | 62 | unsigned long align, |
63 | unsigned long goal, | ||
64 | unsigned long limit); | ||
59 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | 65 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE |
60 | extern void reserve_bootmem (unsigned long addr, unsigned long size); | 66 | extern void reserve_bootmem (unsigned long addr, unsigned long size); |
61 | #define alloc_bootmem(x) \ | 67 | #define alloc_bootmem(x) \ |
@@ -68,10 +74,20 @@ extern void reserve_bootmem (unsigned long addr, unsigned long size); | |||
68 | __alloc_bootmem_low(x, PAGE_SIZE, 0) | 74 | __alloc_bootmem_low(x, PAGE_SIZE, 0) |
69 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | 75 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ |
70 | extern unsigned long free_all_bootmem (void); | 76 | extern unsigned long free_all_bootmem (void); |
71 | extern void * __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal); | 77 | extern void * __alloc_bootmem_node (pg_data_t *pgdat, |
72 | extern unsigned long init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn); | 78 | unsigned long size, |
73 | extern void reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size); | 79 | unsigned long align, |
74 | extern void free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size); | 80 | unsigned long goal); |
81 | extern unsigned long init_bootmem_node (pg_data_t *pgdat, | ||
82 | unsigned long freepfn, | ||
83 | unsigned long startpfn, | ||
84 | unsigned long endpfn); | ||
85 | extern void reserve_bootmem_node (pg_data_t *pgdat, | ||
86 | unsigned long physaddr, | ||
87 | unsigned long size); | ||
88 | extern void free_bootmem_node (pg_data_t *pgdat, | ||
89 | unsigned long addr, | ||
90 | unsigned long size); | ||
75 | extern unsigned long free_all_bootmem_node (pg_data_t *pgdat); | 91 | extern unsigned long free_all_bootmem_node (pg_data_t *pgdat); |
76 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | 92 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE |
77 | #define alloc_bootmem_node(pgdat, x) \ | 93 | #define alloc_bootmem_node(pgdat, x) \ |
diff --git a/mm/bootmem.c b/mm/bootmem.c index 70f1528a3c8a..9083f5029673 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -102,7 +102,8 @@ static unsigned long __init init_bootmem_core (pg_data_t *pgdat, | |||
102 | * might be used for boot-time allocations - or it might get added | 102 | * might be used for boot-time allocations - or it might get added |
103 | * to the free page pool later on. | 103 | * to the free page pool later on. |
104 | */ | 104 | */ |
105 | static void __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long addr, unsigned long size) | 105 | static void __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long addr, |
106 | unsigned long size) | ||
106 | { | 107 | { |
107 | unsigned long i; | 108 | unsigned long i; |
108 | /* | 109 | /* |
@@ -127,7 +128,8 @@ static void __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long add | |||
127 | } | 128 | } |
128 | } | 129 | } |
129 | 130 | ||
130 | static void __init free_bootmem_core(bootmem_data_t *bdata, unsigned long addr, unsigned long size) | 131 | static void __init free_bootmem_core(bootmem_data_t *bdata, unsigned long addr, |
132 | unsigned long size) | ||
131 | { | 133 | { |
132 | unsigned long i; | 134 | unsigned long i; |
133 | unsigned long start; | 135 | unsigned long start; |
@@ -355,17 +357,20 @@ static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat) | |||
355 | return total; | 357 | return total; |
356 | } | 358 | } |
357 | 359 | ||
358 | unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn) | 360 | unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, |
361 | unsigned long startpfn, unsigned long endpfn) | ||
359 | { | 362 | { |
360 | return(init_bootmem_core(pgdat, freepfn, startpfn, endpfn)); | 363 | return(init_bootmem_core(pgdat, freepfn, startpfn, endpfn)); |
361 | } | 364 | } |
362 | 365 | ||
363 | void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size) | 366 | void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, |
367 | unsigned long size) | ||
364 | { | 368 | { |
365 | reserve_bootmem_core(pgdat->bdata, physaddr, size); | 369 | reserve_bootmem_core(pgdat->bdata, physaddr, size); |
366 | } | 370 | } |
367 | 371 | ||
368 | void __init free_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size) | 372 | void __init free_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, |
373 | unsigned long size) | ||
369 | { | 374 | { |
370 | free_bootmem_core(pgdat->bdata, physaddr, size); | 375 | free_bootmem_core(pgdat->bdata, physaddr, size); |
371 | } | 376 | } |
@@ -399,7 +404,8 @@ unsigned long __init free_all_bootmem (void) | |||
399 | return(free_all_bootmem_core(NODE_DATA(0))); | 404 | return(free_all_bootmem_core(NODE_DATA(0))); |
400 | } | 405 | } |
401 | 406 | ||
402 | void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align, unsigned long goal) | 407 | void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align, |
408 | unsigned long goal) | ||
403 | { | 409 | { |
404 | bootmem_data_t *bdata; | 410 | bootmem_data_t *bdata; |
405 | void *ptr; | 411 | void *ptr; |
@@ -410,7 +416,8 @@ void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align, u | |||
410 | return NULL; | 416 | return NULL; |
411 | } | 417 | } |
412 | 418 | ||
413 | void * __init __alloc_bootmem(unsigned long size, unsigned long align, unsigned long goal) | 419 | void * __init __alloc_bootmem(unsigned long size, unsigned long align, |
420 | unsigned long goal) | ||
414 | { | 421 | { |
415 | void *mem = __alloc_bootmem_nopanic(size,align,goal); | 422 | void *mem = __alloc_bootmem_nopanic(size,align,goal); |
416 | if (mem) | 423 | if (mem) |
@@ -424,8 +431,8 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align, unsigned | |||
424 | } | 431 | } |
425 | 432 | ||
426 | 433 | ||
427 | void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, unsigned long align, | 434 | void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, |
428 | unsigned long goal) | 435 | unsigned long align, unsigned long goal) |
429 | { | 436 | { |
430 | void *ptr; | 437 | void *ptr; |
431 | 438 | ||
@@ -438,7 +445,8 @@ void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, unsigne | |||
438 | 445 | ||
439 | #define LOW32LIMIT 0xffffffff | 446 | #define LOW32LIMIT 0xffffffff |
440 | 447 | ||
441 | void * __init __alloc_bootmem_low(unsigned long size, unsigned long align, unsigned long goal) | 448 | void * __init __alloc_bootmem_low(unsigned long size, unsigned long align, |
449 | unsigned long goal) | ||
442 | { | 450 | { |
443 | bootmem_data_t *bdata; | 451 | bootmem_data_t *bdata; |
444 | void *ptr; | 452 | void *ptr; |