bootmem: remove not implemented function call, bootmem_arch_preferred_node()
Subsystems (6)
PATCH 1/4 bootmem: remove not implemented function call, bootmem_arch_preferred_node()
There is no implementation of bootmeme_arch_preferred_node() and call for this function will makes compile-error.
So, remove it.
mm/bootmem.c +0 -13
@@ -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,
Signature · 7 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/4 avr32, kconfig: remove HAVE_ARCH_BOOTMEM
Now, there is no code for CONFIG_HAVE_ARCH_BOOTMEM. So remove it.
arch/avr32/Kconfig +0 -3
@@ -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
Signature · 7 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/4] avr32, kconfig: remove HAVE_ARCH_BOOTMEM
Quoted 2 lines · Joonsoo Kim
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.
Quoted 3 lines
Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Signed-off-by Joonsoo Kim <[email protected]>
<snipp diff>
Signature · 2 lines
mvh Hans-Christian Egtvedt
Re: [PATCH 2/4] avr32, kconfig: remove HAVE_ARCH_BOOTMEM
In reply to Joonsoo KimQuoted 6 lines · Joonsoo Kim
Now, there is no code for
CONFIG_HAVE_ARCH_BOOTMEM. So remove it.Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Signed-off-by Joonsoo Kim <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/4 bootmem: remove alloc_arch_preferred_bootmem()
In reply to Joonsoo KimThe 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.
mm/bootmem.c +4 -15
@@ -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)
Signature · 7 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 3/4] bootmem: remove alloc_arch_preferred_bootmem()
Quoted 8 lines · 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
whenslab_is_available(), so directly return kmalloc*'s return value.Signed-off-by Joonsoo Kim <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/4 bootmem: fix wrong call parameter for free_bootmem()
In reply to Joonsoo KimIt 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.
arch/powerpc/platforms/cell/celleb_pci.c +2 -2
@@ -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); } }
drivers/macintosh/smu.c +1 -1
@@ -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);
lib/cpumask.c +1 -1
@@ -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
Signature · 7 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerRe: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
Quoted 6 lines · On Tue, 13 Nov 2012 01:31:55 +0900 Joonsoo Kim <[email protected]> wrote:
It is somehow strange that
alloc_bootmemreturn virtual address andfree_bootmemrequire 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 <[email protected]>
Subject: bootmem-fix-wrong-call-parameter-for-free_bootmem-fix
improve free_bootmem() and free_bootmem_pate() documentation
---
include/linux/bootmem.h | 4 ++-- mm/bootmem.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-)
mm/bootmem.c renamed from mm/bootmem.c~bootmem-fix-wrong-call-parameter-for-free_bootmem-fix +10 -10
@@ -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 ); }
include/linux/bootmem.h renamed from include/linux/bootmem.h~bootmem-fix-wrong-call-parameter-for-free_bootmem-fix +2 -2
@@ -51,8 +51,8 @@ extern unsigned long free_all_bootmem(voextern 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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
Hi, Andrew.
2012/11/13 Andrew Morton <[email protected]>:
Quoted 102 lines
Quoted 6 lines · On Tue, 13 Nov 2012 01:31:55 +0900 Joonsoo Kim <[email protected]> wrote:
It is somehow strange that
alloc_bootmemreturn virtual address andfree_bootmemrequire 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 <[email protected]>
Subject: bootmem-fix-wrong-call-parameter-for-free_bootmem-fiximprove
free_bootmem()andfree_bootmem_pate()documentationCc Benjamin Herrenschmidt <[email protected]>Cc FUJITA Tomonori <[email protected]>Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Cc Johannes Weiner <[email protected]>Cc Joonsoo Kim <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
include/linux/bootmem.h | 4 ++-- mm/bootmem.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-)mm/bootmem.c renamed from mm/bootmem.c~bootmem-fix-wrong-call-parameter-for-free_bootmem-fix +10
-10@@ -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 ); }include/linux/bootmem.h renamed from include/linux/bootmem.h~bootmem-fix-wrong-call-parameter-for-free_bootmem-fix +2
-2@@ -51,8 +51,8 @@ extern unsigned long free_all_bootmem(voextern 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,
Quoted 1 line
_
Looks good to me :)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
In reply to Andrew MortonQuoted 11 lines · Andrew Morton
Quoted 6 lines · On Tue, 13 Nov 2012 01:31:55 +0900 Joonsoo Kim <[email protected]> wrote:
It is somehow strange that
alloc_bootmemreturn virtual address andfree_bootmemrequire 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.
Quoted 1 line
How does this look?
Much better. How about this in addition?
---
include/linux/bootmem.h +1 -1
@@ -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);
mm/bootmem.c +2 -2
@@ -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.
mm/nobootmem.c +9 -9
@@ -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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
In reply to Joonsoo KimQuoted 10 lines · Joonsoo Kim
It is somehow strange that
alloc_bootmemreturn virtual address andfree_bootmemrequire 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 <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Signed-off-by Joonsoo Kim <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
In reply to Joonsoo KimQuoted 10 lines · Joonsoo Kim
It is somehow strange that
alloc_bootmemreturn virtual address andfree_bootmemrequire 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 <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Signed-off-by Joonsoo Kim <[email protected]>
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?
---
drivers/macintosh/smu.c +1 -1
@@ -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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/4] bootmem: fix wrong call parameter for free_bootmem()
Quoted 8 lines · Johannes Weiner
Quoted 7 lines · Joonsoo Kim
It is somehow strange that
alloc_bootmemreturn virtual address andfree_bootmemrequire 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.
Quoted 7 lines
Quoted 3 lines
Cc Andrew Morton <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Signed-off-by Joonsoo Kim <[email protected]>Found another one, attached below. The
free_bootmem()inarch/powerpc/platforms/82xx/pq2ads-pci-pic.clooks also fishy, since it's applied to memory fromkzalloc(). 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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · 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 <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>