diff options
author | Joonsoo Kim <js1304@gmail.com> | 2012-12-11 19:03:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-11 20:22:28 -0500 |
commit | 81df9bff2609f07cef4690ac2ebda1611b55b05a (patch) | |
tree | 52c5ebc7e9e5efd93040cba5f0439e043eec368e /mm | |
parent | e9b2e78c6a4247b1bb3e89c61e7d73636d2e48d1 (diff) |
bootmem: fix wrong call parameter for free_bootmem()
It is strange that alloc_bootmem() returns a virtual address and
free_bootmem() requires a physical address. Anyway, free_bootmem()'s
first parameter should be physical address.
There are some call sites for free_bootmem() with virtual address. So fix
them.
[akpm@linux-foundation.org: improve free_bootmem() and free_bootmem_pate() documentation]
Signed-off-by: Joonsoo Kim <js1304@gmail.com>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/bootmem.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c index f468185b3b2..ecc45958ac0 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -147,21 +147,21 @@ unsigned long __init init_bootmem(unsigned long start, unsigned long pages) | |||
147 | 147 | ||
148 | /* | 148 | /* |
149 | * free_bootmem_late - free bootmem pages directly to page allocator | 149 | * free_bootmem_late - free bootmem pages directly to page allocator |
150 | * @addr: starting address of the range | 150 | * @addr: starting physical address of the range |
151 | * @size: size of the range in bytes | 151 | * @size: size of the range in bytes |
152 | * | 152 | * |
153 | * This is only useful when the bootmem allocator has already been torn | 153 | * This is only useful when the bootmem allocator has already been torn |
154 | * down, but we are still initializing the system. Pages are given directly | 154 | * down, but we are still initializing the system. Pages are given directly |
155 | * to the page allocator, no bootmem metadata is updated because it is gone. | 155 | * to the page allocator, no bootmem metadata is updated because it is gone. |
156 | */ | 156 | */ |
157 | void __init free_bootmem_late(unsigned long addr, unsigned long size) | 157 | void __init free_bootmem_late(unsigned long physaddr, unsigned long size) |
158 | { | 158 | { |
159 | unsigned long cursor, end; | 159 | unsigned long cursor, end; |
160 | 160 | ||
161 | kmemleak_free_part(__va(addr), size); | 161 | kmemleak_free_part(__va(physaddr), size); |
162 | 162 | ||
163 | cursor = PFN_UP(addr); | 163 | cursor = PFN_UP(physaddr); |
164 | end = PFN_DOWN(addr + size); | 164 | end = PFN_DOWN(physaddr + size); |
165 | 165 | ||
166 | for (; cursor < end; cursor++) { | 166 | for (; cursor < end; cursor++) { |
167 | __free_pages_bootmem(pfn_to_page(cursor), 0); | 167 | __free_pages_bootmem(pfn_to_page(cursor), 0); |
@@ -377,21 +377,21 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, | |||
377 | 377 | ||
378 | /** | 378 | /** |
379 | * free_bootmem - mark a page range as usable | 379 | * free_bootmem - mark a page range as usable |
380 | * @addr: starting address of the range | 380 | * @addr: starting physical address of the range |
381 | * @size: size of the range in bytes | 381 | * @size: size of the range in bytes |
382 | * | 382 | * |
383 | * Partial pages will be considered reserved and left as they are. | 383 | * Partial pages will be considered reserved and left as they are. |
384 | * | 384 | * |
385 | * The range must be contiguous but may span node boundaries. | 385 | * The range must be contiguous but may span node boundaries. |
386 | */ | 386 | */ |
387 | void __init free_bootmem(unsigned long addr, unsigned long size) | 387 | void __init free_bootmem(unsigned long physaddr, unsigned long size) |
388 | { | 388 | { |
389 | unsigned long start, end; | 389 | unsigned long start, end; |
390 | 390 | ||
391 | kmemleak_free_part(__va(addr), size); | 391 | kmemleak_free_part(__va(physaddr), size); |
392 | 392 | ||
393 | start = PFN_UP(addr); | 393 | start = PFN_UP(physaddr); |
394 | end = PFN_DOWN(addr + size); | 394 | end = PFN_DOWN(physaddr + size); |
395 | 395 | ||
396 | mark_bootmem(start, end, 0, 0); | 396 | mark_bootmem(start, end, 0, 0); |
397 | } | 397 | } |