[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 13 Nov 2012 09:36:22 +0900
From: JoonSoo Kim <js1304@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Johannes Weiner <hannes@...xchg.org>,
FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
Subject: Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
Hi, Andrew.
2012/11/13 Andrew Morton <akpm@...ux-foundation.org>:
> On Tue, 13 Nov 2012 01:31:55 +0900
> Joonsoo Kim <js1304@...il.com> wrote:
>
>> It is somehow strange that alloc_bootmem return virtual address
>> and free_bootmem require 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.
>
> Well gee, I wonder how that happened :(
>
>
> How does this look?
>
> From: Andrew Morton <akpm@...ux-foundation.org>
> Subject: bootmem-fix-wrong-call-parameter-for-free_bootmem-fix
>
> improve free_bootmem() and free_bootmem_pate() documentation
>
> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
> Cc: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
> Cc: Haavard Skinnemoen <hskinnemoen@...il.com>
> Cc: Hans-Christian Egtvedt <egtvedt@...fundet.no>
> Cc: Johannes Weiner <hannes@...xchg.org>
> Cc: Joonsoo Kim <js1304@...il.com>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> ---
>
> include/linux/bootmem.h | 4 ++--
> mm/bootmem.c | 20 ++++++++++----------
> 2 files changed, 12 insertions(+), 12 deletions(-)
>
> --- a/mm/bootmem.c~bootmem-fix-wrong-call-parameter-for-free_bootmem-fix
> +++ a/mm/bootmem.c
> @@ -147,21 +147,21 @@ unsigned long __init init_bootmem(unsign
>
> /*
> * free_bootmem_late - free bootmem pages directly to page allocator
> - * @addr: starting address of the range
> + * @addr: starting physical address of the range
> * @size: size of the range in bytes
> *
> * This is only useful when the bootmem allocator has already been torn
> * down, but we are still initializing the system. Pages are given directly
> * to the page allocator, no bootmem metadata is updated because it is gone.
> */
> -void __init free_bootmem_late(unsigned long addr, unsigned long size)
> +void __init free_bootmem_late(unsigned long physaddr, unsigned long size)
> {
> unsigned long cursor, end;
>
> - kmemleak_free_part(__va(addr), size);
> + kmemleak_free_part(__va(physaddr), size);
>
> - cursor = PFN_UP(addr);
> - end = PFN_DOWN(addr + size);
> + cursor = PFN_UP(physaddr);
> + end = PFN_DOWN(physaddr + size);
>
> for (; cursor < end; cursor++) {
> __free_pages_bootmem(pfn_to_page(cursor), 0);
> @@ -385,21 +385,21 @@ void __init free_bootmem_node(pg_data_t
>
> /**
> * free_bootmem - mark a page range as usable
> - * @addr: starting address of the range
> + * @addr: starting physical address of the range
> * @size: size of the range in bytes
> *
> * Partial pages will be considered reserved and left as they are.
> *
> * The range must be contiguous but may span node boundaries.
> */
> -void __init free_bootmem(unsigned long addr, unsigned long size)
> +void __init free_bootmem(unsigned long physaddr, unsigned long size)
> {
> unsigned long start, end;
>
> - kmemleak_free_part(__va(addr), size);
> + kmemleak_free_part(__va(physaddr), size);
>
> - start = PFN_UP(addr);
> - end = PFN_DOWN(addr + size);
> + start = PFN_UP(physaddr);
> + end = PFN_DOWN(physaddr + size);
>
> mark_bootmem(start, end, 0, 0);
> }
> --- a/include/linux/bootmem.h~bootmem-fix-wrong-call-parameter-for-free_bootmem-fix
> +++ a/include/linux/bootmem.h
> @@ -51,8 +51,8 @@ extern unsigned long free_all_bootmem(vo
> extern void free_bootmem_node(pg_data_t *pgdat,
> unsigned long addr,
> unsigned long size);
> -extern void free_bootmem(unsigned long addr, unsigned long size);
> -extern void free_bootmem_late(unsigned long addr, unsigned long size);
> +extern void free_bootmem(unsigned long physaddr, unsigned long size);
> +extern void free_bootmem_late(unsigned long physaddr, unsigned long size);
>
> /*
> * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
> _
Looks good to me :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists