* [PATCH] mm: make free_bootmem to loop bdata_list
@ 2008-03-13 18:53 Yinghai Lu
2008-03-13 19:05 ` Andrew Morton
2008-03-14 1:39 ` KAMEZAWA Hiroyuki
0 siblings, 2 replies; 7+ messages in thread
From: Yinghai Lu @ 2008-03-13 18:53 UTC (permalink / raw)
To: Andrew Morton
Cc: mingo, clameter, linux-kernel, Andi Kleen, Yasunori Goto,
KAMEZAWA Hiroyuki
[-- Attachment #1: Type: text/plain, Size: 381 bytes --]
[PATCH] mm: make free_bootmem to loop bdata_list
[PATCH] mm: fix boundary checking in free_bootmem_core
make the free_bootmem_core could handle out of range case. we could use
bdata_list to make sure the range can be freed for sure.
so next time, we don't need to loop online nodes and could use
free_bootmem directly.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: free_bootmem_loop_x.patch --]
[-- Type: text/x-patch; name=free_bootmem_loop_x.patch, Size: 507 bytes --]
Index: linux-2.6/mm/bootmem.c
===================================================================
--- linux-2.6.orig/mm/bootmem.c
+++ linux-2.6/mm/bootmem.c
@@ -427,7 +438,9 @@ int __init reserve_bootmem(unsigned long
void __init free_bootmem(unsigned long addr, unsigned long size)
{
- free_bootmem_core(NODE_DATA(0)->bdata, addr, size);
+ bootmem_data_t *bdata;
+ list_for_each_entry(bdata, &bdata_list, list)
+ free_bootmem_core(bdata, addr, size);
}
unsigned long __init free_all_bootmem(void)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: make free_bootmem to loop bdata_list
2008-03-13 18:53 [PATCH] mm: make free_bootmem to loop bdata_list Yinghai Lu
@ 2008-03-13 19:05 ` Andrew Morton
2008-03-13 19:10 ` Yinghai Lu
2008-03-14 1:39 ` KAMEZAWA Hiroyuki
1 sibling, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2008-03-13 19:05 UTC (permalink / raw)
To: Yinghai Lu; +Cc: mingo, clameter, linux-kernel, ak, y-goto, kamezawa.hiroyu
On Thu, 13 Mar 2008 11:53:31 -0700
"Yinghai Lu" <yhlu.kernel@gmail.com> wrote:
> [PATCH] mm: make free_bootmem to loop bdata_list
>
> [PATCH] mm: fix boundary checking in free_bootmem_core
>
> make the free_bootmem_core could handle out of range case. we could use
> bdata_list to make sure the range can be freed for sure.
>
> so next time, we don't need to loop online nodes and could use
> free_bootmem directly.
>
> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>
What is the relationship (if any) between this and
mm-fix-boundary-checking-in-free_bootmem_core.patch?
Do you believe ths new patch is needed in 2.6.25 and if so, why?
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: make free_bootmem to loop bdata_list
2008-03-13 19:05 ` Andrew Morton
@ 2008-03-13 19:10 ` Yinghai Lu
0 siblings, 0 replies; 7+ messages in thread
From: Yinghai Lu @ 2008-03-13 19:10 UTC (permalink / raw)
To: Andrew Morton; +Cc: mingo, clameter, linux-kernel, ak, y-goto, kamezawa.hiroyu
On Thu, Mar 13, 2008 at 12:05 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
>
> On Thu, 13 Mar 2008 11:53:31 -0700
> "Yinghai Lu" <yhlu.kernel@gmail.com> wrote:
>
> > [PATCH] mm: make free_bootmem to loop bdata_list
> >
> > [PATCH] mm: fix boundary checking in free_bootmem_core
> >
> > make the free_bootmem_core could handle out of range case. we could use
> > bdata_list to make sure the range can be freed for sure.
> >
> > so next time, we don't need to loop online nodes and could use
> > free_bootmem directly.
> >
> > Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
> >
>
> What is the relationship (if any) between this and
> mm-fix-boundary-checking-in-free_bootmem_core.patch?
after mm-fix-boundary-checking-in-free_bootmem_core.patch, or you can
fold this into that.
>
> Do you believe ths new patch is needed in 2.6.25 and if so, why?
could solve some free_bootmem in extreme case like no ram on node 0.
YH
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: make free_bootmem to loop bdata_list
2008-03-14 1:39 ` KAMEZAWA Hiroyuki
@ 2008-03-14 1:39 ` Yinghai Lu
2008-03-14 2:04 ` KAMEZAWA Hiroyuki
0 siblings, 1 reply; 7+ messages in thread
From: Yinghai Lu @ 2008-03-14 1:39 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, mingo, clameter, linux-kernel, Andi Kleen,
Yasunori Goto
On Thu, Mar 13, 2008 at 6:39 PM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Thu, 13 Mar 2008 11:53:31 -0700
> "Yinghai Lu" <yhlu.kernel@gmail.com> wrote:
> > ===================================================================
> > --- linux-2.6.orig/mm/bootmem.c
> > +++ linux-2.6/mm/bootmem.c
> > @@ -427,7 +438,9 @@ int __init reserve_bootmem(unsigned long
> >
> > void __init free_bootmem(unsigned long addr, unsigned long size)
> > {
> > - free_bootmem_core(NODE_DATA(0)->bdata, addr, size);
> > + bootmem_data_t *bdata;
> > + list_for_each_entry(bdata, &bdata_list, list)
> > + free_bootmem_core(bdata, addr, size);
> > }
>
>
> Just a confirmation.
> In above loop, boundary check in free_bootmem_core() hits two or more times ?
> If yes, it's ok.
> If no, please exit loop at hit.
yes. need that handle range cross node (RAMDISK case that is end
beyond end_of_ram).
YH
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: make free_bootmem to loop bdata_list
2008-03-13 18:53 [PATCH] mm: make free_bootmem to loop bdata_list Yinghai Lu
2008-03-13 19:05 ` Andrew Morton
@ 2008-03-14 1:39 ` KAMEZAWA Hiroyuki
2008-03-14 1:39 ` Yinghai Lu
1 sibling, 1 reply; 7+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-03-14 1:39 UTC (permalink / raw)
To: Yinghai Lu
Cc: Andrew Morton, mingo, clameter, linux-kernel, Andi Kleen,
Yasunori Goto
On Thu, 13 Mar 2008 11:53:31 -0700
"Yinghai Lu" <yhlu.kernel@gmail.com> wrote:
> ===================================================================
> --- linux-2.6.orig/mm/bootmem.c
> +++ linux-2.6/mm/bootmem.c
> @@ -427,7 +438,9 @@ int __init reserve_bootmem(unsigned long
>
> void __init free_bootmem(unsigned long addr, unsigned long size)
> {
> - free_bootmem_core(NODE_DATA(0)->bdata, addr, size);
> + bootmem_data_t *bdata;
> + list_for_each_entry(bdata, &bdata_list, list)
> + free_bootmem_core(bdata, addr, size);
> }
Just a confirmation.
In above loop, boundary check in free_bootmem_core() hits two or more times ?
If yes, it's ok.
If no, please exit loop at hit.
Thanks,
-Kame
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: make free_bootmem to loop bdata_list
2008-03-14 1:39 ` Yinghai Lu
@ 2008-03-14 2:04 ` KAMEZAWA Hiroyuki
2008-03-14 2:07 ` Yinghai Lu
0 siblings, 1 reply; 7+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-03-14 2:04 UTC (permalink / raw)
To: Yinghai Lu
Cc: Andrew Morton, mingo, clameter, linux-kernel, Andi Kleen,
Yasunori Goto
On Thu, 13 Mar 2008 18:39:34 -0700
"Yinghai Lu" <yhlu.kernel@gmail.com> wrote:
> On Thu, Mar 13, 2008 at 6:39 PM, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > On Thu, 13 Mar 2008 11:53:31 -0700
> > "Yinghai Lu" <yhlu.kernel@gmail.com> wrote:
> > > ===================================================================
> > > --- linux-2.6.orig/mm/bootmem.c
> > > +++ linux-2.6/mm/bootmem.c
> > > @@ -427,7 +438,9 @@ int __init reserve_bootmem(unsigned long
> > >
> > > void __init free_bootmem(unsigned long addr, unsigned long size)
> > > {
> > > - free_bootmem_core(NODE_DATA(0)->bdata, addr, size);
> > > + bootmem_data_t *bdata;
> > > + list_for_each_entry(bdata, &bdata_list, list)
> > > + free_bootmem_core(bdata, addr, size);
> > > }
> >
> >
> > Just a confirmation.
> > In above loop, boundary check in free_bootmem_core() hits two or more times ?
> > If yes, it's ok.
> > If no, please exit loop at hit.
>
> yes. need that handle range cross node (RAMDISK case that is end
> beyond end_of_ram).
>
Then, <addr, size> can spread across nodes.
IMHO, there are *big* memory hole between nodes in some systems.
This kind of interface, which allows alloc/free bootmem accross nodes,
will see terrible trouble when a programmer assumes "alloc/free bootmem
always return contiguous size of memory" (This is guaranteed now,)
Does the new allocator (you changed ?) guarantee that returned <address, size>
is fully contiguous even if it spreads accross nodes ?
If no, NACK for this version.
Thanks,
-Kame
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: make free_bootmem to loop bdata_list
2008-03-14 2:04 ` KAMEZAWA Hiroyuki
@ 2008-03-14 2:07 ` Yinghai Lu
0 siblings, 0 replies; 7+ messages in thread
From: Yinghai Lu @ 2008-03-14 2:07 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, mingo, clameter, linux-kernel, Andi Kleen,
Yasunori Goto
On Thu, Mar 13, 2008 at 7:04 PM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Thu, 13 Mar 2008 18:39:34 -0700
>
> "Yinghai Lu" <yhlu.kernel@gmail.com> wrote:
>
> > On Thu, Mar 13, 2008 at 6:39 PM, KAMEZAWA Hiroyuki
> > <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > > On Thu, 13 Mar 2008 11:53:31 -0700
> > > "Yinghai Lu" <yhlu.kernel@gmail.com> wrote:
> > > > ===================================================================
> > > > --- linux-2.6.orig/mm/bootmem.c
> > > > +++ linux-2.6/mm/bootmem.c
> > > > @@ -427,7 +438,9 @@ int __init reserve_bootmem(unsigned long
> > > >
> > > > void __init free_bootmem(unsigned long addr, unsigned long size)
> > > > {
> > > > - free_bootmem_core(NODE_DATA(0)->bdata, addr, size);
> > > > + bootmem_data_t *bdata;
> > > > + list_for_each_entry(bdata, &bdata_list, list)
> > > > + free_bootmem_core(bdata, addr, size);
> > > > }
> > >
> > >
> > > Just a confirmation.
> > > In above loop, boundary check in free_bootmem_core() hits two or more times ?
> > > If yes, it's ok.
> > > If no, please exit loop at hit.
> >
> > yes. need that handle range cross node (RAMDISK case that is end
> > beyond end_of_ram).
> >
> Then, <addr, size> can spread across nodes.
>
> IMHO, there are *big* memory hole between nodes in some systems.
> This kind of interface, which allows alloc/free bootmem accross nodes,
> will see terrible trouble when a programmer assumes "alloc/free bootmem
> always return contiguous size of memory" (This is guaranteed now,)
>
> Does the new allocator (you changed ?) guarantee that returned <address, size>
> is fully contiguous even if it spreads accross nodes ?
>
> If no, NACK for this version.
i didn't change alloc_mem, it still get range from one node and continuous.
new free_bootmem could remove the assumpition in
setup_64.c::setup_arch:free_bootmem about node0
/* Assumes everything on node 0 */
free_bootmem(ramdisk_image, ramdisk_size);
printk(KERN_ERR "initrd extends beyond end of memory "
"(0x%08lx > 0x%08lx)\ndisabling initrd\n",
ramdisk_end, end_of_mem);
initrd_start = 0;
YH
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-03-14 2:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-13 18:53 [PATCH] mm: make free_bootmem to loop bdata_list Yinghai Lu
2008-03-13 19:05 ` Andrew Morton
2008-03-13 19:10 ` Yinghai Lu
2008-03-14 1:39 ` KAMEZAWA Hiroyuki
2008-03-14 1:39 ` Yinghai Lu
2008-03-14 2:04 ` KAMEZAWA Hiroyuki
2008-03-14 2:07 ` Yinghai Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox