From: JoonSoo Kim <js1304@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Johannes Weiner <hannes@cmpxchg.org>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Subject: Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
Date: Tue, 13 Nov 2012 09:36:22 +0900 [thread overview]
Message-ID: <CAAmzW4NbwztA_bGoJ9y11n9BiznW6hX-dnHt3MrCfiWnDYZ9UQ@mail.gmail.com> (raw)
In-Reply-To: <20121112152342.ce90052a.akpm@linux-foundation.org>
Hi, Andrew.
2012/11/13 Andrew Morton <akpm@linux-foundation.org>:
> On Tue, 13 Nov 2012 01:31:55 +0900
> Joonsoo Kim <js1304@gmail.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@linux-foundation.org>
> Subject: bootmem-fix-wrong-call-parameter-for-free_bootmem-fix
>
> improve free_bootmem() and free_bootmem_pate() documentation
>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
> Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Joonsoo Kim <js1304@gmail.com>
> Signed-off-by: Andrew Morton <akpm@linux-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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-11-13 0:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-12 16:31 [PATCH 1/4] bootmem: remove not implemented function call, bootmem_arch_preferred_node() Joonsoo Kim
2012-11-12 16:31 ` [PATCH 2/4] avr32, kconfig: remove HAVE_ARCH_BOOTMEM Joonsoo Kim
2012-11-12 18:36 ` Hans-Christian Egtvedt
2012-11-13 0:50 ` Johannes Weiner
2012-11-12 16:31 ` [PATCH 3/4] bootmem: remove alloc_arch_preferred_bootmem() Joonsoo Kim
2012-11-13 0:55 ` Johannes Weiner
2012-11-12 16:31 ` [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem() Joonsoo Kim
2012-11-12 23:23 ` Andrew Morton
2012-11-13 0:36 ` JoonSoo Kim [this message]
2012-11-13 1:24 ` Johannes Weiner
2012-11-13 0:58 ` Johannes Weiner
2012-11-13 1:10 ` Johannes Weiner
2012-11-13 1:13 ` Johannes Weiner
2012-11-13 0:49 ` [PATCH 1/4] bootmem: remove not implemented function call, bootmem_arch_preferred_node() Johannes Weiner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAmzW4NbwztA_bGoJ9y11n9BiznW6hX-dnHt3MrCfiWnDYZ9UQ@mail.gmail.com \
--to=js1304@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox