2008-06-05 23:07:25

by Johannes Weiner

[permalink] [raw]
Subject: [PATCH -mm 00/14] bootmem rewrite v4

Hi,

This is a complete overhaul of the bootmem allocator while preserving
most of its original functionality.

free_bootmem and reserve_bootmem become a bit stricter than they are
right now, callsites have to make sure that the PFN range is
contiguous but it might go across node boundaries.

alloc_bootmem satisfying the allocation goal is more likely as the
routines will try to allocate on the node holding the goal first
before falling back as opposed to the original behaviour that
satisfies the goal only if it is on the first node.

All in all, I think the code has become simpler and cleaner. All
public interfaces have been documented, too.

version 4: based on -mmotm from 08-06-05
o fixed fallback logic in alloc_bootmem_core (take the fallback even
in cases where sidx is zero) to make Yasunori's machine boot again
o fixed bogus range checks in ___alloc_bootmem_nopanic
o removed bogus `fallback'-offset calculation in alloc_bootmem_core
o renamed last_offset to last_end_off
o renamed last_success to hint_idx
o start searching after the end of the previous allocation, not at
its beginning
o improved more identifier names for offsets, pfns, indices and
addresses
o adjusted debugging output to output hex numbers consistently

version 3:
o fixed kerneldoc as noted by Chris Malley
o fixed incorrect bdata->last_success treatment as noted by
Yasunori Goto

version 2:
o broken up patches into logical chunks

---

arch/alpha/mm/numa.c | 2 +-
arch/arm/plat-omap/fb.c | 4 +-
arch/avr32/mm/init.c | 3 +-
arch/ia64/mm/discontig.c | 19 +-
arch/m32r/mm/discontig.c | 3 +-
arch/m32r/mm/init.c | 4 +-
arch/mn10300/mm/init.c | 6 +-
arch/sh/mm/init.c | 2 +-
include/linux/bootmem.h | 87 +++---
mm/bootmem.c | 934 +++++++++++++++++++++++++---------------------
10 files changed, 570 insertions(+), 494 deletions(-)


2008-06-06 01:16:45

by Yasunori Goto

[permalink] [raw]
Subject: Re: [PATCH -mm 00/14] bootmem rewrite v4


OK.
I reviewed this patch set, and my ia64 box can boot up with it. :-)

Thanks.

Acked-by: Yasunori Goto <[email protected]>


> Hi,
>
> This is a complete overhaul of the bootmem allocator while preserving
> most of its original functionality.
>
> free_bootmem and reserve_bootmem become a bit stricter than they are
> right now, callsites have to make sure that the PFN range is
> contiguous but it might go across node boundaries.
>
> alloc_bootmem satisfying the allocation goal is more likely as the
> routines will try to allocate on the node holding the goal first
> before falling back as opposed to the original behaviour that
> satisfies the goal only if it is on the first node.
>
> All in all, I think the code has become simpler and cleaner. All
> public interfaces have been documented, too.
>
> version 4: based on -mmotm from 08-06-05
> o fixed fallback logic in alloc_bootmem_core (take the fallback even
> in cases where sidx is zero) to make Yasunori's machine boot again
> o fixed bogus range checks in ___alloc_bootmem_nopanic
> o removed bogus `fallback'-offset calculation in alloc_bootmem_core
> o renamed last_offset to last_end_off
> o renamed last_success to hint_idx
> o start searching after the end of the previous allocation, not at
> its beginning
> o improved more identifier names for offsets, pfns, indices and
> addresses
> o adjusted debugging output to output hex numbers consistently
>
> version 3:
> o fixed kerneldoc as noted by Chris Malley
> o fixed incorrect bdata->last_success treatment as noted by
> Yasunori Goto
>
> version 2:
> o broken up patches into logical chunks
>
> ---
>
> arch/alpha/mm/numa.c | 2 +-
> arch/arm/plat-omap/fb.c | 4 +-
> arch/avr32/mm/init.c | 3 +-
> arch/ia64/mm/discontig.c | 19 +-
> arch/m32r/mm/discontig.c | 3 +-
> arch/m32r/mm/init.c | 4 +-
> arch/mn10300/mm/init.c | 6 +-
> arch/sh/mm/init.c | 2 +-
> include/linux/bootmem.h | 87 +++---
> mm/bootmem.c | 934 +++++++++++++++++++++++++---------------------
> 10 files changed, 570 insertions(+), 494 deletions(-)
>

--
Yasunori Goto

2008-06-08 20:35:28

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH -mm 00/14] bootmem rewrite v4

On Fri, 06 Jun 2008 00:49:40 +0200 Johannes Weiner <[email protected]> wrote:

> This is a complete overhaul of the bootmem allocator while preserving
> most of its original functionality.

Confused. This conflicts with patches from yourself which I have already
merged.

2008-06-08 21:53:42

by Johannes Weiner

[permalink] [raw]
Subject: Re: [PATCH -mm 00/14] bootmem rewrite v4

Hi,

Andrew Morton <[email protected]> writes:

> On Fri, 06 Jun 2008 00:49:40 +0200 Johannes Weiner <[email protected]> wrote:
>
>> This is a complete overhaul of the bootmem allocator while preserving
>> most of its original functionality.
>
> Confused. This conflicts with patches from yourself which I have already
> merged.

Hum. I just tried again:

- checkout v2.6.26-rc5
- get latest mmotm broken-out tarball (stamp-2008-06-07-02-27)
- git-quiltimport
- apply the bootmem series

and no conflicts. Anything I missed? Which files are conflicting, btw?

Hannes

2008-06-08 23:33:42

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH -mm 00/14] bootmem rewrite v4

On Sun, 08 Jun 2008 23:52:47 +0200 Johannes Weiner <[email protected]> wrote:

> Hi,
>
> Andrew Morton <[email protected]> writes:
>
> > On Fri, 06 Jun 2008 00:49:40 +0200 Johannes Weiner <[email protected]> wrote:
> >
> >> This is a complete overhaul of the bootmem allocator while preserving
> >> most of its original functionality.
> >
> > Confused. This conflicts with patches from yourself which I have already
> > merged.
>
> Hum. I just tried again:
>
> - checkout v2.6.26-rc5
> - get latest mmotm broken-out tarball (stamp-2008-06-07-02-27)
> - git-quiltimport
> - apply the bootmem series
>
> and no conflicts. Anything I missed? Which files are conflicting, btw?
>

bootmem-reorder-code-to-match-new-bootmem-structure.patch spits:

***************
*** 575,609 ****
return ptr;
}
#endif
-
- #ifndef ARCH_LOW_ADDRESS_LIMIT
- #define ARCH_LOW_ADDRESS_LIMIT 0xffffffffUL
- #endif
-
- void * __init __alloc_bootmem_low(unsigned long size, unsigned long align,
- unsigned long goal)
- {
- bootmem_data_t *bdata;
- void *ptr;
-
- list_for_each_entry(bdata, &bdata_list, list) {
- ptr = alloc_bootmem_core(bdata, size, align, goal,
- ARCH_LOW_ADDRESS_LIMIT);
- if (ptr)
- return ptr;
- }
-
- /*
- * Whoops, we cannot satisfy the allocation request.
- */
- printk(KERN_ALERT "low bootmem alloc of %lu bytes failed!\n", size);
- panic("Out of low memory");
- return NULL;
- }
-
- void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size,
- unsigned long align, unsigned long goal)
- {
- return alloc_bootmem_core(pgdat->bdata, size, align, goal,
- ARCH_LOW_ADDRESS_LIMIT);
- }
--- 606,608 ----
return ptr;
}
#endif

and

***************
*** 79,107 ****
__alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
#define alloc_bootmem_low_pages(x) \
__alloc_bootmem_low(x, PAGE_SIZE, 0)
- #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
-
- extern unsigned long free_all_bootmem(void);
- extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
- extern void *__alloc_bootmem_node(pg_data_t *pgdat,
- unsigned long size,
- unsigned long align,
- unsigned long goal);
- extern unsigned long init_bootmem_node(pg_data_t *pgdat,
- unsigned long freepfn,
- unsigned long startpfn,
- unsigned long endpfn);
- extern void reserve_bootmem_node(pg_data_t *pgdat,
- unsigned long physaddr,
- unsigned long size,
- int flags);
- extern void free_bootmem_node(pg_data_t *pgdat,
- unsigned long addr,
- unsigned long size);
- extern void *alloc_bootmem_section(unsigned long size,
- unsigned long section_nr);
-
- #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
#define alloc_bootmem_node(pgdat, x) \
__alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
#define alloc_bootmem_pages_node(pgdat, x) \
--- 101,106 ----
__alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
#define alloc_bootmem_low_pages(x) \
__alloc_bootmem_low(x, PAGE_SIZE, 0)
#define alloc_bootmem_node(pgdat, x) \
__alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
#define alloc_bootmem_pages_node(pgdat, x) \

Seems that Nick's mm-introduce-non-panic-alloc_bootmem.patch mucked
things up. I'll have a go at fixing things.