Re: [PATCH] x86: introduce bootmem_state -v2

Ingo Molnar
2009-03-06T21:35:49Z

* Yinghai Lu <yinghai@kernel.org> wrote:

> Ingo Molnar wrote:
> > * Yinghai Lu <yinghai@kernel.org> wrote:
> >
> >> Ingo Molnar wrote:
> >>> * Yinghai Lu <yinghai@kernel.org> wrote:
> >>>
> >>>> Impact: cleanup
> >>>>
> >>>> extend after_bootmem and after_init_bootmem to bootmem_state
> >>>> and will have BEFORE_BOOTMEM, DURING_BOOTMEM, AFTER_BOOTMEM
> >>>>
> >>>> v2: style changes according to ingo
> >>>>
> >>>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> >>>>
> >>>> ---
> >>>> arch/x86/kernel/setup.c | 1 +
> >>>> arch/x86/mm/init.c | 13 +++++++------
> >>>> arch/x86/mm/init_32.c | 28 ++++++++++++++++++++--------
> >>>> arch/x86/mm/init_64.c | 33 +++++++++++++++++++--------------
> >>>> include/linux/mm.h | 9 +++++++++
> >>>> 5 files changed, 56 insertions(+), 28 deletions(-)
> >>>> Index: linux-2.6/include/linux/mm.h
> >>>> ===================================================================
> >>>> --- linux-2.6.orig/include/linux/mm.h
> >>>> +++ linux-2.6/include/linux/mm.h
> >>>> @@ -1067,6 +1067,15 @@ extern void __init mmap_init(void);
> >>>> extern void show_mem(void);
> >>>> extern void si_meminfo(struct sysinfo * val);
> >>>> extern void si_meminfo_node(struct sysinfo *val, int nid);
> >>>> +
> >>>> +enum bootmem_state {
> >>>> + BEFORE_BOOTMEM,
> >>>> + DURING_BOOTMEM,
> >>>> + AFTER_BOOTMEM
> >>>> +};
> >>>> +
> >>>> +extern enum bootmem_state bootmem_state;
> >>>> +
> >>>> extern int after_bootmem;
> >>> Btw., the after_bootmem variable itself should either move
> >>> to x86 (and arch/sh), or should be defined in mm/bootmem.c.
> >>>
> >>> Right now we have this weird mm.h construct that is not
> >>> actually useful to generic code.
> >> with this patch, only sh is using after_bootmem. could
> >> 1. make sh to use bootmem_state
> >> 2. then remove after_bootmem
> >
> > Hm, lets leave arch/sh alone for now i think - the commits are
> > desintd for the x86 tree.
> >
> > But we should move our after_bootmem to arch/x86/include/ and
> > not pollute mm.h with it. It's an x86 internal detail for now.
> >
>
> you mean move bootmem_state to arch/x86/include ?
> with this patch are not using after_bootmem anymore.

Correct. So basically we change x86 to use bootmem_state only,
and leave mm.h alone. arch/sh can still use after_bootmem.
(which it should likely move to its own header files - but
that's for a different patch)

Ingo