linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] bootmem: remove not implemented function call, bootmem_arch_preferred_node()
@ 2012-11-12 16:31 Joonsoo Kim
  2012-11-12 16:31 ` [PATCH 2/4] avr32, kconfig: remove HAVE_ARCH_BOOTMEM Joonsoo Kim
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Joonsoo Kim @ 2012-11-12 16:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-mm, Joonsoo Kim

There is no implementation of bootmeme_arch_preferred_node() and
call for this function will makes compile-error.
So, remove it.

Signed-off-by: Joonsoo Kim <js1304@gmail.com>

diff --git a/mm/bootmem.c b/mm/bootmem.c
index 434be4a..6f62c03e 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -589,19 +589,6 @@ static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata,
 {
 	if (WARN_ON_ONCE(slab_is_available()))
 		return kzalloc(size, GFP_NOWAIT);
-
-#ifdef CONFIG_HAVE_ARCH_BOOTMEM
-	{
-		bootmem_data_t *p_bdata;
-
-		p_bdata = bootmem_arch_preferred_node(bdata, size, align,
-							goal, limit);
-		if (p_bdata)
-			return alloc_bootmem_bdata(p_bdata, size, align,
-							goal, limit);
-	}
-#endif
-	return NULL;
 }
 
 static void * __init alloc_bootmem_core(unsigned long size,
-- 
1.7.9.5

--
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>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/4] avr32, kconfig: remove HAVE_ARCH_BOOTMEM
  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 ` 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
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 14+ messages in thread
From: Joonsoo Kim @ 2012-11-12 16:31 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-mm, Joonsoo Kim, Haavard Skinnemoen,
	Hans-Christian Egtvedt

Now, there is no code for CONFIG_HAVE_ARCH_BOOTMEM.
So remove it.

Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Signed-off-by: Joonsoo Kim <js1304@gmail.com>

diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 06e73bf..c2bbc9a 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -193,9 +193,6 @@ source "kernel/Kconfig.preempt"
 config QUICKLIST
 	def_bool y
 
-config HAVE_ARCH_BOOTMEM
-	def_bool n
-
 config ARCH_HAVE_MEMORY_PRESENT
 	def_bool n
 
-- 
1.7.9.5

--
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>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/4] bootmem: remove alloc_arch_preferred_bootmem()
  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 16:31 ` 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-13  0:49 ` [PATCH 1/4] bootmem: remove not implemented function call, bootmem_arch_preferred_node() Johannes Weiner
  3 siblings, 1 reply; 14+ messages in thread
From: Joonsoo Kim @ 2012-11-12 16:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-mm, Joonsoo Kim

The name of function is not suitable for now.
And removing function and inlining it's code to each call sites
makes code more understandable.

Additionally, we shouldn't do allocation from bootmem
when slab_is_available(), so directly return kmalloc*'s return value.

Signed-off-by: Joonsoo Kim <js1304@gmail.com>

diff --git a/mm/bootmem.c b/mm/bootmem.c
index 6f62c03e..cd5c5a2 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -583,14 +583,6 @@ find_block:
 	return NULL;
 }
 
-static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata,
-					unsigned long size, unsigned long align,
-					unsigned long goal, unsigned long limit)
-{
-	if (WARN_ON_ONCE(slab_is_available()))
-		return kzalloc(size, GFP_NOWAIT);
-}
-
 static void * __init alloc_bootmem_core(unsigned long size,
 					unsigned long align,
 					unsigned long goal,
@@ -599,9 +591,8 @@ static void * __init alloc_bootmem_core(unsigned long size,
 	bootmem_data_t *bdata;
 	void *region;
 
-	region = alloc_arch_preferred_bootmem(NULL, size, align, goal, limit);
-	if (region)
-		return region;
+	if (WARN_ON_ONCE(slab_is_available()))
+		return kzalloc(size, GFP_NOWAIT);
 
 	list_for_each_entry(bdata, &bdata_list, list) {
 		if (goal && bdata->node_low_pfn <= PFN_DOWN(goal))
@@ -699,11 +690,9 @@ void * __init ___alloc_bootmem_node_nopanic(pg_data_t *pgdat,
 {
 	void *ptr;
 
+	if (WARN_ON_ONCE(slab_is_available()))
+		return kzalloc(size, GFP_NOWAIT);
 again:
-	ptr = alloc_arch_preferred_bootmem(pgdat->bdata, size,
-					   align, goal, limit);
-	if (ptr)
-		return ptr;
 
 	/* do not panic in alloc_bootmem_bdata() */
 	if (limit && goal + size > limit)
-- 
1.7.9.5

--
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>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
  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 16:31 ` [PATCH 3/4] bootmem: remove alloc_arch_preferred_bootmem() Joonsoo Kim
@ 2012-11-12 16:31 ` Joonsoo Kim
  2012-11-12 23:23   ` Andrew Morton
                     ` (2 more replies)
  2012-11-13  0:49 ` [PATCH 1/4] bootmem: remove not implemented function call, bootmem_arch_preferred_node() Johannes Weiner
  3 siblings, 3 replies; 14+ messages in thread
From: Joonsoo Kim @ 2012-11-12 16:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-mm, Joonsoo Kim, Benjamin Herrenschmidt

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.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Joonsoo Kim <js1304@gmail.com>

diff --git a/arch/powerpc/platforms/cell/celleb_pci.c b/arch/powerpc/platforms/cell/celleb_pci.c
index abc8af4..1735681 100644
--- a/arch/powerpc/platforms/cell/celleb_pci.c
+++ b/arch/powerpc/platforms/cell/celleb_pci.c
@@ -401,11 +401,11 @@ error:
 	} else {
 		if (config && *config) {
 			size = 256;
-			free_bootmem((unsigned long)(*config), size);
+			free_bootmem(__pa(*config), size);
 		}
 		if (res && *res) {
 			size = sizeof(struct celleb_pci_resource);
-			free_bootmem((unsigned long)(*res), size);
+			free_bootmem(__pa(*res), size);
 		}
 	}
 
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 7d5a6b4..1963680 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -565,7 +565,7 @@ fail_msg_node:
 fail_db_node:
 	of_node_put(smu->db_node);
 fail_bootmem:
-	free_bootmem((unsigned long)smu, sizeof(struct smu_device));
+	free_bootmem(__pa(smu), sizeof(struct smu_device));
 	smu = NULL;
 fail_np:
 	of_node_put(np);
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 402a54a..d327b87 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -161,6 +161,6 @@ EXPORT_SYMBOL(free_cpumask_var);
  */
 void __init free_bootmem_cpumask_var(cpumask_var_t mask)
 {
-	free_bootmem((unsigned long)mask, cpumask_size());
+	free_bootmem(__pa(mask), cpumask_size());
 }
 #endif
-- 
1.7.9.5

--
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>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] avr32, kconfig: remove HAVE_ARCH_BOOTMEM
  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
  1 sibling, 0 replies; 14+ messages in thread
From: Hans-Christian Egtvedt @ 2012-11-12 18:36 UTC (permalink / raw)
  To: Joonsoo Kim; +Cc: Andrew Morton, linux-kernel, linux-mm, Haavard Skinnemoen

Around Tue 13 Nov 2012 01:31:53 +0900 or thereabout, Joonsoo Kim wrote:
> Now, there is no code for CONFIG_HAVE_ARCH_BOOTMEM.
> So remove it.

Indeed, thanks for cleaning. In a not too distant future I'll re-establish
the AVR32 tree on kernel.org, I'm just waiting for my account to be
made/enabled again.

> Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
> Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> Signed-off-by: Joonsoo Kim <js1304@gmail.com>

Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>

<snipp diff>

-- 
mvh
Hans-Christian Egtvedt

--
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>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
  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
  2012-11-13  1:24     ` Johannes Weiner
  2012-11-13  0:58   ` Johannes Weiner
  2012-11-13  1:10   ` Johannes Weiner
  2 siblings, 2 replies; 14+ messages in thread
From: Andrew Morton @ 2012-11-12 23:23 UTC (permalink / raw)
  To: Joonsoo Kim
  Cc: linux-kernel, linux-mm, Benjamin Herrenschmidt, Johannes Weiner,
	FUJITA Tomonori

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,
_

--
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>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
  2012-11-12 23:23   ` Andrew Morton
@ 2012-11-13  0:36     ` JoonSoo Kim
  2012-11-13  1:24     ` Johannes Weiner
  1 sibling, 0 replies; 14+ messages in thread
From: JoonSoo Kim @ 2012-11-13  0:36 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-mm, Benjamin Herrenschmidt, Johannes Weiner,
	FUJITA Tomonori

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>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/4] bootmem: remove not implemented function call, bootmem_arch_preferred_node()
  2012-11-12 16:31 [PATCH 1/4] bootmem: remove not implemented function call, bootmem_arch_preferred_node() Joonsoo Kim
                   ` (2 preceding siblings ...)
  2012-11-12 16:31 ` [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem() Joonsoo Kim
@ 2012-11-13  0:49 ` Johannes Weiner
  3 siblings, 0 replies; 14+ messages in thread
From: Johannes Weiner @ 2012-11-13  0:49 UTC (permalink / raw)
  To: Joonsoo Kim; +Cc: Andrew Morton, linux-kernel, linux-mm

On Tue, Nov 13, 2012 at 01:31:52AM +0900, Joonsoo Kim wrote:
> There is no implementation of bootmeme_arch_preferred_node() and
> call for this function will makes compile-error.
> So, remove it.
> 
> Signed-off-by: Joonsoo Kim <js1304@gmail.com>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

--
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>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] avr32, kconfig: remove HAVE_ARCH_BOOTMEM
  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
  1 sibling, 0 replies; 14+ messages in thread
From: Johannes Weiner @ 2012-11-13  0:50 UTC (permalink / raw)
  To: Joonsoo Kim
  Cc: Andrew Morton, linux-kernel, linux-mm, Haavard Skinnemoen,
	Hans-Christian Egtvedt

On Tue, Nov 13, 2012 at 01:31:53AM +0900, Joonsoo Kim wrote:
> Now, there is no code for CONFIG_HAVE_ARCH_BOOTMEM.
> So remove it.
> 
> Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
> Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> Signed-off-by: Joonsoo Kim <js1304@gmail.com>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

--
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>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/4] bootmem: remove alloc_arch_preferred_bootmem()
  2012-11-12 16:31 ` [PATCH 3/4] bootmem: remove alloc_arch_preferred_bootmem() Joonsoo Kim
@ 2012-11-13  0:55   ` Johannes Weiner
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Weiner @ 2012-11-13  0:55 UTC (permalink / raw)
  To: Joonsoo Kim; +Cc: Andrew Morton, linux-kernel, linux-mm

On Tue, Nov 13, 2012 at 01:31:54AM +0900, Joonsoo Kim wrote:
> The name of function is not suitable for now.
> And removing function and inlining it's code to each call sites
> makes code more understandable.
> 
> Additionally, we shouldn't do allocation from bootmem
> when slab_is_available(), so directly return kmalloc*'s return value.
> 
> Signed-off-by: Joonsoo Kim <js1304@gmail.com>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

--
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>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
  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:58   ` Johannes Weiner
  2012-11-13  1:10   ` Johannes Weiner
  2 siblings, 0 replies; 14+ messages in thread
From: Johannes Weiner @ 2012-11-13  0:58 UTC (permalink / raw)
  To: Joonsoo Kim; +Cc: Andrew Morton, linux-kernel, linux-mm, Benjamin Herrenschmidt

On Tue, Nov 13, 2012 at 01:31:55AM +0900, Joonsoo Kim 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.
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Joonsoo Kim <js1304@gmail.com>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

--
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>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
  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:58   ` Johannes Weiner
@ 2012-11-13  1:10   ` Johannes Weiner
  2012-11-13  1:13     ` Johannes Weiner
  2 siblings, 1 reply; 14+ messages in thread
From: Johannes Weiner @ 2012-11-13  1:10 UTC (permalink / raw)
  To: Joonsoo Kim; +Cc: Andrew Morton, linux-kernel, linux-mm, Benjamin Herrenschmidt

On Tue, Nov 13, 2012 at 01:31:55AM +0900, Joonsoo Kim 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.
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Joonsoo Kim <js1304@gmail.com>

Found another one, attached below.  The free_bootmem() in
arch/powerpc/platforms/82xx/pq2ads-pci-pic.c looks also fishy, since
it's applied to memory from kzalloc().  Ben?

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---

diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 7d5a6b4..1963680 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -565,7 +565,7 @@ int __init smu_init (void)
 fail_db_node:
 	of_node_put(smu->db_node);
 fail_bootmem:
-	free_bootmem((unsigned long)smu, sizeof(struct smu_device));
+	free_bootmem(__pa(smu), sizeof(struct smu_device));
 	smu = NULL;
 fail_np:
 	of_node_put(np);

--
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>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
  2012-11-13  1:10   ` Johannes Weiner
@ 2012-11-13  1:13     ` Johannes Weiner
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Weiner @ 2012-11-13  1:13 UTC (permalink / raw)
  To: Joonsoo Kim; +Cc: Andrew Morton, linux-kernel, linux-mm, Benjamin Herrenschmidt

On Mon, Nov 12, 2012 at 08:10:27PM -0500, Johannes Weiner wrote:
> On Tue, Nov 13, 2012 at 01:31:55AM +0900, Joonsoo Kim 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.
> > 
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Signed-off-by: Joonsoo Kim <js1304@gmail.com>
> 
> Found another one, attached below.  The free_bootmem() in
> arch/powerpc/platforms/82xx/pq2ads-pci-pic.c looks also fishy, since
> it's applied to memory from kzalloc().  Ben?

Eh, missed the smu.c one in Joonsoo's patch.  powerpc one still
strange.

--
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>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
  2012-11-12 23:23   ` Andrew Morton
  2012-11-13  0:36     ` JoonSoo Kim
@ 2012-11-13  1:24     ` Johannes Weiner
  1 sibling, 0 replies; 14+ messages in thread
From: Johannes Weiner @ 2012-11-13  1:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Joonsoo Kim, linux-kernel, linux-mm, Benjamin Herrenschmidt,
	FUJITA Tomonori

On Mon, Nov 12, 2012 at 03:23:42PM -0800, Andrew Morton wrote:
> 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 :(

free_bootmem() is the counterpart to reserve_bootmem() to configure
physical memory ranges.  Allocations are assumed to be permanent.

> How does this look?

Much better.  How about this in addition?

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---

diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 7b74452..b519cb2 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -49,7 +49,7 @@ extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
 extern unsigned long free_all_bootmem(void);
 
 extern void free_bootmem_node(pg_data_t *pgdat,
-			      unsigned long addr,
+			      unsigned long physaddr,
 			      unsigned long size);
 extern void free_bootmem(unsigned long physaddr, unsigned long size);
 extern void free_bootmem_late(unsigned long physaddr, unsigned long size);
diff --git a/mm/bootmem.c b/mm/bootmem.c
index 4c079ba..5135d84 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -147,7 +147,7 @@ unsigned long __init init_bootmem(unsigned long start, unsigned long pages)
 
 /*
  * free_bootmem_late - free bootmem pages directly to page allocator
- * @addr: starting physical address of the range
+ * @physaddr: 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
@@ -385,7 +385,7 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
 
 /**
  * free_bootmem - mark a page range as usable
- * @addr: starting physical address of the range
+ * @physaddr: starting physical address of the range
  * @size: size of the range in bytes
  *
  * Partial pages will be considered reserved and left as they are.
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index 714d5d6..a532960 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -58,21 +58,21 @@ static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
 
 /*
  * free_bootmem_late - free bootmem pages directly to page allocator
- * @addr: starting address of the range
+ * @physaddr: 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);
@@ -188,17 +188,17 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
 
 /**
  * free_bootmem - mark a page range as usable
- * @addr: starting address of the range
+ * @physaddr: 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)
 {
-	kmemleak_free_part(__va(addr), size);
-	memblock_free(addr, size);
+	kmemleak_free_part(__va(physaddr), size);
+	memblock_free(physaddr, size);
 }
 
 static void * __init ___alloc_bootmem_nopanic(unsigned long size,

--
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>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-11-13  1:24 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).