x86: rename after_init_bootmem to after_bootmem in mm/init_32.c
PATCH 7/17 x86: rename after_init_bootmem to after_bootmem in mm/init_32.c
Impact: cleanup
This patch renames after_init_bootmem to after_bootmem in mm/init_32.c to reduce the diff to the 64-bit version of of init_memory_mapping().
--- arch/x86/mm/init_32.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
arch/x86/mm/init_32.c +8 -8
@@ -63,7 +63,7 @@ static unsigned long __initdata table_start;static unsigned long __meminitdata table_end;static unsigned long __meminitdata table_top; -static int __initdata after_init_bootmem; +int after_bootmem;int direct_gbpages;
@@ -92,7 +92,7 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)#ifdef CONFIG_X86_PAE if (!(pgd_val (*pgd) & _PAGE_PRESENT)) { -if (after_init_bootmem) +if (after_bootmem) pmd_table = (pmd_t *)alloc_bootmem_low_pages (PAGE_SIZE );else pmd_table = (pmd_t *)alloc_low_page ();
@@ -119,7 +119,7 @@ static pte_t * __init one_page_table_init(pmd_t *pmd)if (!(pmd_val (*pmd) & _PAGE_PRESENT)) {pte_t *page_table =NULL ; -if (after_init_bootmem) { +if (after_bootmem) {#ifdef CONFIG_DEBUG_PAGEALLOC page_table = (pte_t *)alloc_bootmem_pages (PAGE_SIZE );#endif
@@ -158,7 +158,7 @@ static pte_t *__init page_table_kmap_check(pte_t *pte, pmd_t *pmd,pte_t *newpte;int i; -BUG_ON (after_init_bootmem); +BUG_ON (after_bootmem); newpte =alloc_low_page ();for (i =0 ; i <PTRS_PER_PTE ; i++)set_pte (newpte + i, pte[i]);
@@ -831,7 +831,7 @@ void __init setup_bootmem_allocator(void) bootmap =setup_node_bootmem (0 ,0 , max_low_pfn, bootmap);#endif - after_init_bootmem =1 ; + after_bootmem =1 ; } static void __init find_early_table_space(unsigned long end, int use_pse,
@@ -1037,7 +1037,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,* memory mapped. Unfortunately this is done currently before the * nodes are discovered. */ -if (!after_init_bootmem) +if (!after_bootmem)find_early_table_space (end, use_pse, use_gbpages);for (i =0 ; i < nr_range; i++)
@@ -1052,11 +1052,11 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,__flush_tlb_all (); -if (!after_init_bootmem) +if (!after_bootmem)reserve_early (table_start <<PAGE_SHIFT , table_end <<PAGE_SHIFT ,"PGTABLE" ); -if (!after_init_bootmem) +if (!after_bootmem)early_memtest (start, end);return end >>PAGE_SHIFT ;
Signature · 1 line
1.5.4.3
Commit-ID: c464573cb3d3bdd45eed8f5f59596f84ede95a0c Gitweb: http://git.kernel.org/tip/c464573cb3d3bdd45eed8f5f59596f84ede95a0c Author: "Pekka Enberg" <[email protected]> AuthorDate: Thu, 5 Mar 2009 14:54:58 +0200 Commit: Ingo Molnar <[email protected]> CommitDate: Thu, 5 Mar 2009 14:17:13 +0100
x86: rename after_init_bootmem to after_bootmem in mm/init_32.c
Impact: cleanup
This patch renames after_init_bootmem to after_bootmem in mm/init_32.c to reduce the diff to the 64-bit version of of init_memory_mapping().
LKML-Reference: <[email protected]>
--- arch/x86/mm/init_32.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
arch/x86/mm/init_32.c +8 -8
@@ -63,7 +63,7 @@ static unsigned long __initdata table_start;static unsigned long __meminitdata table_end;static unsigned long __meminitdata table_top; -static int __initdata after_init_bootmem; +int after_bootmem;int direct_gbpages;
@@ -92,7 +92,7 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)#ifdef CONFIG_X86_PAE if (!(pgd_val (*pgd) & _PAGE_PRESENT)) { -if (after_init_bootmem) +if (after_bootmem) pmd_table = (pmd_t *)alloc_bootmem_low_pages (PAGE_SIZE );else pmd_table = (pmd_t *)alloc_low_page ();
@@ -119,7 +119,7 @@ static pte_t * __init one_page_table_init(pmd_t *pmd)if (!(pmd_val (*pmd) & _PAGE_PRESENT)) {pte_t *page_table =NULL ; -if (after_init_bootmem) { +if (after_bootmem) {#ifdef CONFIG_DEBUG_PAGEALLOC page_table = (pte_t *)alloc_bootmem_pages (PAGE_SIZE );#endif
@@ -158,7 +158,7 @@ static pte_t *__init page_table_kmap_check(pte_t *pte, pmd_t *pmd,pte_t *newpte;int i; -BUG_ON (after_init_bootmem); +BUG_ON (after_bootmem); newpte =alloc_low_page ();for (i =0 ; i <PTRS_PER_PTE ; i++)set_pte (newpte + i, pte[i]);
@@ -831,7 +831,7 @@ void __init setup_bootmem_allocator(void) bootmap =setup_node_bootmem (0 ,0 , max_low_pfn, bootmap);#endif - after_init_bootmem =1 ; + after_bootmem =1 ; } static void __init find_early_table_space(unsigned long end, int use_pse,
@@ -1037,7 +1037,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,* memory mapped. Unfortunately this is done currently before the * nodes are discovered. */ -if (!after_init_bootmem) +if (!after_bootmem)find_early_table_space (end, use_pse, use_gbpages);for (i =0 ; i < nr_range; i++)
@@ -1052,11 +1052,11 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,__flush_tlb_all (); -if (!after_init_bootmem) +if (!after_bootmem)reserve_early (table_start <<PAGE_SHIFT , table_end <<PAGE_SHIFT ,"PGTABLE" ); -if (!after_init_bootmem) +if (!after_bootmem)early_memtest (start, end);return end >>PAGE_SHIFT ;
Quoted 4 lines · Pekka Enberg
Impact: cleanup
This patch renames
after_init_bootmemtoafter_bootmeminmm/init_32.cto reduce the diff to the 64-bit version of ofinit_memory_mapping().
not sure,after_init_bootmem seems bootmem could be used.after_bootmem seems bootmem are freed already.
YH
Quoted 79 lines
Cc Yinghai Lu <[email protected]>Signed-off-by Pekka Enberg <[email protected]>--- arch/x86/mm/init_32.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)arch/x86/mm/init_32.c +8
-8@@ -63,7 +63,7 @@ static unsigned long __initdata table_start;static unsigned long __meminitdata table_end;static unsigned long __meminitdata table_top; -static int __initdata after_init_bootmem; +int after_bootmem;int direct_gbpages;@@ -92,7 +92,7 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)#ifdef CONFIG_X86_PAE if (!(pgd_val (*pgd) & _PAGE_PRESENT)) { -if (after_init_bootmem) +if (after_bootmem) pmd_table = (pmd_t *)alloc_bootmem_low_pages (PAGE_SIZE );else pmd_table = (pmd_t *)alloc_low_page ();@@ -119,7 +119,7 @@ static pte_t * __init one_page_table_init(pmd_t *pmd)if (!(pmd_val (*pmd) & _PAGE_PRESENT)) {pte_t *page_table =NULL ; -if (after_init_bootmem) { +if (after_bootmem) {#ifdef CONFIG_DEBUG_PAGEALLOC page_table = (pte_t *)alloc_bootmem_pages (PAGE_SIZE );#endif @@ -158,7 +158,7 @@ static pte_t *__init page_table_kmap_check(pte_t *pte, pmd_t *pmd,pte_t *newpte;int i; -BUG_ON (after_init_bootmem); +BUG_ON (after_bootmem); newpte =alloc_low_page ();for (i =0 ; i <PTRS_PER_PTE ; i++)set_pte (newpte + i, pte[i]);@@ -831,7 +831,7 @@ void __init setup_bootmem_allocator(void) bootmap =setup_node_bootmem (0 ,0 , max_low_pfn, bootmap);#endif - after_init_bootmem =1 ; + after_bootmem =1 ; } static void __init find_early_table_space(unsigned long end, int use_pse,@@ -1037,7 +1037,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,* memory mapped. Unfortunately this is done currently before the * nodes are discovered. */ -if (!after_init_bootmem) +if (!after_bootmem)find_early_table_space (end, use_pse, use_gbpages);for (i =0 ; i < nr_range; i++)@@ -1052,11 +1052,11 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,__flush_tlb_all (); -if (!after_init_bootmem) +if (!after_bootmem)reserve_early (table_start <<PAGE_SHIFT , table_end <<PAGE_SHIFT ,"PGTABLE" ); -if (!after_init_bootmem) +if (!after_bootmem)early_memtest (start, end);return end >>PAGE_SHIFT ;
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 x86: introduce bootmem_state
Impact: cleanup
extend after_bootmem and after_init_bootmem to bootmem_state and will have BEFORE_BOOTMEM, DURING_BOOTMEM, AFTER_BOOTMEM
--- 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 | 8 ++++++++ 5 files changed, 55 insertions(+), 28 deletions(-)
arch/x86/kernel/setup.c +1 -0
@@ -885,6 +885,7 @@ void __init setup_arch(char **cmdline_p)#endif initmem_init (0 , max_pfn); + bootmem_state =DURING_BOOTMEM ;#ifdef CONFIG_ACPI_SLEEP /*
arch/x86/mm/init.c +7 -6
@@ -14,7 +14,7 @@ unsigned long __initdata e820_table_starunsigned long __meminitdata e820_table_end;unsigned long __meminitdata e820_table_top; -int after_bootmem; +enum bootmem_state_t bootmem_state =BEFORE_BOOTMEM ; int direct_gbpages#ifdef CONFIG_DIRECT_GBPAGES
@@ -143,7 +143,7 @@ unsigned long __init_refok init_memory_mprintk (KERN_INFO "init_memory_mapping: %016lx-%016lx\n" , start, end); -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )init_gbpages ();#if defined(CONFIG_DEBUG_PAGEALLOC ) || defined(CONFIG_KMEMCHECK )
@@ -283,7 +283,7 @@ unsigned long __init_refok init_memory_m* memory mapped. Unfortunately this is done currently before the * nodes are discovered. */ -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )find_early_table_space (end, use_pse, use_gbpages);#ifdef CONFIG_X86_32
@@ -304,16 +304,17 @@ unsigned long __init_refok init_memory_m#endif #ifdef CONFIG_X86_64 -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM ) mmu_cr4_features =read_cr4 ();#endif __flush_tlb_all (); -if (!after_bootmem && e820_table_end > e820_table_start) +if (bootmem_state ==BEFORE_BOOTMEM && + e820_table_end > e820_table_start)reserve_early (e820_table_start <<PAGE_SHIFT , e820_table_end <<PAGE_SHIFT ,"PGTABLE" ); -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )early_memtest (start, end);return ret >>PAGE_SHIFT ;
arch/x86/mm/init_32.c +20 -8
@@ -82,14 +82,20 @@ static __init void *alloc_low_page(void)static pmd_t *__init one_md_table_init (pgd_t *pgd) {pud_t *pud; -pmd_t *pmd_table; +pmd_t *pmd_table =NULL ;#ifdef CONFIG_X86_PAE if (!(pgd_val (*pgd) & _PAGE_PRESENT)) { -if (after_bootmem) +switch (bootmem_state) { +case DURING_BOOTMEM : pmd_table = (pmd_t *)alloc_bootmem_low_pages (PAGE_SIZE ); -else +break ; +case BEFORE_BOOTMEM : pmd_table = (pmd_t *)alloc_low_page (); +break ; +default : +panic ("after bootmem call one_md_table_init\n" ); + }paravirt_alloc_pmd (&init_mm,__pa (pmd_table) >>PAGE_SHIFT );set_pgd (pgd,__pgd (__pa (pmd_table) | _PAGE_PRESENT)); pud =pud_offset (pgd,0 );
@@ -113,15 +119,21 @@ static pte_t * __init one_page_table_iniif (!(pmd_val (*pmd) & _PAGE_PRESENT)) {pte_t *page_table =NULL ; -if (after_bootmem) { +switch (bootmem_state) { +case DURING_BOOTMEM :#if defined(CONFIG_DEBUG_PAGEALLOC ) || defined(CONFIG_KMEMCHECK ) page_table = (pte_t *)alloc_bootmem_pages (PAGE_SIZE );#endif if (!page_table) page_table = (pte_t *)alloc_bootmem_low_pages (PAGE_SIZE ); - }else +break ; +case BEFORE_BOOTMEM : page_table = (pte_t *)alloc_low_page (); +break ; +default : +panic ("after bootmem call one_page_table_init\n" ); + }paravirt_alloc_pte (&init_mm,__pa (page_table) >>PAGE_SHIFT );set_pmd (pmd,__pmd (__pa (page_table) | _PAGE_TABLE));
@@ -169,7 +181,7 @@ static pte_t *__init page_table_kmap_chepte_t *newpte;int i; -BUG_ON (after_bootmem); +BUG_ON (bootmem_state !=BEFORE_BOOTMEM ); newpte =alloc_low_page ();for (i =0 ; i <PTRS_PER_PTE ; i++)set_pte (newpte + i, pte[i]);
@@ -855,8 +867,6 @@ void __init setup_bootmem_allocator(void bootmap =setup_node_bootmem (nodeid, start_pfn, end_pfn, bootmap); } - - after_bootmem =1 ; }/*
@@ -923,6 +933,8 @@ void __init mem_init(void)/* this will put all low memory onto the freelists */ totalram_pages +=free_all_bootmem (); + bootmem_state =AFTER_BOOTMEM ; + reservedpages =0 ;for (tmp =0 ; tmp < max_low_pfn; tmp++)/*
arch/x86/mm/init_64.c +19 -14
@@ -140,20 +140,26 @@ __setup("noexec32=", nonx32_setup);/* * NOTE: This function is marked __ref because it calls __init function -* (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0. +* (alloc_bootmem_pages). It's safe to do it ONLY when DURING_BOOTMEM. */ static __ref void *spp_getpage (void ) { -void *ptr; +void *ptr =NULL ; -if (after_bootmem) +switch (bootmem_state) { +case AFTER_BOOTMEM : ptr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); -else +break ; +case DURING_BOOTMEM : ptr =alloc_bootmem_pages (PAGE_SIZE ); +break ; +default : +panic ("calling spp_getpage before bootmem\n" ); + }if (!ptr || ((unsigned long )ptr & ~PAGE_MASK )) {panic ("set_pte_phys: cannot allocate page data %s\n" , - after_bootmem ?"after bootmem" :"" ); + bootmem_state ==AFTER_BOOTMEM ?"after bootmem" :"" ); }pr_debug ("spp_getpage %p\n" , ptr);
@@ -320,16 +326,17 @@ void __init cleanup_highmap(void)static __ref void *alloc_low_page (unsigned long *phys) { -unsigned long pfn = e820_table_end++; +unsigned long pfn;void *adr; -if (after_bootmem) { +if (bootmem_state ==AFTER_BOOTMEM ) { adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); *phys =__pa (adr);return adr; } + pfn = e820_table_end++;if (pfn >= e820_table_top)panic ("alloc_low_page: ran out of memory" );
@@ -341,7 +348,7 @@ static __ref void *alloc_low_page(unsignstatic __ref void unmap_low_page (void *adr) { -if (after_bootmem) +if (bootmem_state ==AFTER_BOOTMEM )return ;early_iounmap (adr,PAGE_SIZE );
@@ -360,7 +367,7 @@ phys_pte_init(pte_t *pte_page, unsignedfor (i =pte_index (addr); i <PTRS_PER_PTE ; i++, addr +=PAGE_SIZE , pte++) {if (addr >= end) { -if (!after_bootmem) { +if (bootmem_state !=AFTER_BOOTMEM ) {for (; i <PTRS_PER_PTE ; i++, pte++)set_pte (pte,__pte (0 )); }
@@ -416,7 +423,7 @@ phys_pmd_init(pmd_t *pmd_page, unsignedpgprot_t new_prot = prot;if (address >= end) { -if (!after_bootmem) { +if (bootmem_state !=AFTER_BOOTMEM ) {for (; i <PTRS_PER_PMD ; i++, pmd++)set_pmd (pmd,__pmd (0 )); }
@@ -502,7 +509,7 @@ phys_pud_init(pud_t *pud_page, unsignedif (addr >= end)break ; -if (!after_bootmem && +if (bootmem_state !=AFTER_BOOTMEM && !e820_any_mapped (addr, addr+PUD_SIZE ,0 )) {set_pud (pud,__pud (0 ));continue ;
@@ -693,8 +700,6 @@ void __init mem_init(void)/* clear_bss() already clear the empty_zero_page */ - reservedpages =0 ; -/* this will put all low memory onto the freelists */ #ifdef CONFIG_NUMA totalram_pages =numa_free_all_bootmem ();
@@ -702,9 +707,9 @@ void __init mem_init(void) totalram_pages =free_all_bootmem ();#endif + bootmem_state =AFTER_BOOTMEM ; absent_pages =absent_pages_in_range (0 , max_pfn); reservedpages = max_pfn - totalram_pages - absent_pages; - after_bootmem =1 ; codesize = (unsigned long ) &_etext - (unsigned long ) &_text; datasize = (unsigned long ) &_edata - (unsigned long ) &_etext;
include/linux/mm.h +8 -0
@@ -1067,6 +1067,14 @@ 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_t { +BEFORE_BOOTMEM =0 , +DURING_BOOTMEM , +AFTER_BOOTMEM +}; +extern enum bootmem_state_t bootmem_state; +extern int after_bootmem;#ifdef CONFIG_NUMA
H. Peter Anvin
reviewerRe: [PATCH] x86: introduce bootmem_state
Quoted 5 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEM
Wouldn't it make more sense to add these as system_state enumerations and use relational comparisons on them (< <= >= >)?
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
Re: [PATCH] x86: introduce bootmem_state
Quoted 9 lines · H. Peter Anvin
Quoted 5 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEMWouldn't it make more sense to add these as
system_stateenumerations and use relational comparisons on them (< <= >= >)?
it is for fixing problem for x86 32/64 merging. 64bit after_bootmem: after bootmem is freed
32bit after_init_bootmem, after we got bootmem initialized.
and previous init_memory_mapping() merging wrongly rename after_init_bootmem to after_bootmem.
also there is after_paging_init, could be merged lated...
but may change bootmem_state to mm_state
YH
Re: [PATCH] x86: introduce bootmem_state
In reply to H. Peter AnvinQuoted 11 lines · H. Peter Anvin
Quoted 6 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEMWouldn't it make more sense to add these as
system_stateenumerations and use relational comparisons on them (< <= >= >)?
Please, no. system_state should be deprecated; its hard enough to have a notion of some kind of system-wide state, but putting subsystem specific substates into it just makes things worse.
J
H. Peter Anvin
reviewerRe: [PATCH] x86: introduce bootmem_state
Quoted 3 lines · Jeremy Fitzhardinge
Please, no.
system_stateshould be deprecated; its hard enough to have a notion of some kind of system-wide state, but putting subsystem specific substates into it just makes things worse.
Does it? It seems to me to have a bunch of state variables which can interact in $DEITY knows how many ways sounds like a bad idea.
-hpa
Andrew Morton
maintainerRe: [PATCH] x86: introduce bootmem_state
Quoted 10 lines · On Fri, 06 Mar 2009 15:34:01 -0800 "H. Peter Anvin" <[email protected]> wrote:
Quoted 5 lines · Jeremy Fitzhardinge
Please, no.
system_stateshould be deprecated; its hard enough to have a notion of some kind of system-wide state, but putting subsystem specific substates into it just makes things worse.Does it? It seems to me to have a bunch of state variables which can interact in $DEITY knows how many ways sounds like a bad idea.
No, that's the whole point. If each subsystem adds its own subsystem-private state then the subsystems *won't* interact.
Re: [PATCH] x86: introduce bootmem_state
In reply to H. Peter AnvinQuoted 6 lines · H. Peter Anvin
Quoted 3 lines · Jeremy Fitzhardinge
Please, no.
system_stateshould be deprecated; its hard enough to have a notion of some kind of system-wide state, but putting subsystem specific substates into it just makes things worse.Does it? It seems to me to have a bunch of state variables which can interact in $DEITY knows how many ways sounds like a bad idea.
If each state variable describes the state of a single subsystem in a well-defined way then it is meaningful and fairly easy to understand; I would love to have a straightforward way to query which allocator is safe to use at a given moment.
The total number of states is always going to be subsys1 * subsys2 * ..., but folding them all into one state variable only makes sense if we have a well-defined set of states *and* transitions between them. But even then it implies that we have enough coupling between our subsystems that we would even care what their aggregate state is, which is already a bad idea. If we keep the internal workings of our subsystems as internal details, then having private state variables is the way to go.
The real problem with system_state is that it has a few broadly-defined values, but no real explanation of what they mean, so they end up getting used in inappropriate ways (like the virt_addr_valid() thing I fixed yesterday).
J
H. Peter Anvin
reviewerRe: [PATCH] x86: introduce bootmem_state
Quoted 5 lines · Jeremy Fitzhardinge
The total number of states is always going to be subsys1 * subsys2 * ..., but folding them all into one state variable only makes sense if we have a well-defined set of states *and* transitions between them. But even then it implies that we have enough coupling between our subsystems that we would even care what their aggregate state is, which is already a bad idea. If we keep the internal workings of our subsystems as internal details, then having private state variables is the way to go.
The real problem with
system_stateis that it has a few broadly-defined values, but no real explanation of what they mean, so they end up getting used in inappropriate ways (like thevirt_addr_valid()thing I fixed yesterday).
Obviously.
-hpa
Re: [PATCH] x86: introduce bootmem_state
In reply to Yinghai LuQuoted 4 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEM
Ok, that indeed makes all these bootstrap initialization details cleaner and more transparent.
Quoted 9 lines
Signed-off-by Yinghai Lu <[email protected]>--- 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 | 8 ++++++++ 5 files changed, 55 insertions(+), 28 deletions(-)
Note: "git grep after_bootmem" will show you another affected architecture as well.
include/linux/mm.h extern void __init mmap_init(void); · line 1072
Quoted 8 lines
+++
linux-2.6/include/linux/mm.hinclude/linux/mm.h +3
-0@@ -1067,6 +1067,14 @@ 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_t { +BEFORE_BOOTMEM =0 ,
(nit: =0 is not required. )
include/linux/mm.h extern void __init mmap_init(void); · line 1076
Quoted 4 lines
include/linux/mm.h +4
-0+DURING_BOOTMEM , + AFTER_BOOTMEM +}; +extern enum bootmem_state_t bootmem_state;
(nit: we put newlines after enum definitions)
Ingo
Re: [PATCH] x86: introduce bootmem_state
Quoted 20 lines · Ingo Molnar
Quoted 4 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEMOk, that indeed makes all these bootstrap initialization details cleaner and more transparent.
Quoted 9 lines
Signed-off-by Yinghai Lu <[email protected]>--- 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 | 8 ++++++++ 5 files changed, 55 insertions(+), 28 deletions(-)
Quoted 2 lines
Note: "git grep
after_bootmem" will show you another affected architecture as well.
that is sh, will send patch to them later if needed.
Quoted 11 lines
include/linux/mm.h extern void __init mmap_init(void); · line 1072
Quoted 9 lines
+++
linux-2.6/include/linux/mm.hinclude/linux/mm.h +3
-0@@ -1067,6 +1067,14 @@ 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_t { +BEFORE_BOOTMEM =0 ,(nit: =0 is not required. )
some other enum, has it too...
Quoted 7 lines
include/linux/mm.h extern void __init mmap_init(void); · line 1076
Quoted 5 lines
include/linux/mm.h +4
-0+DURING_BOOTMEM , + AFTER_BOOTMEM +}; +extern enum bootmem_state_t bootmem_state;(nit: we put newlines after enum definitions)
ok
YH
PATCH 1/1 x86: introduce bootmem_state -v2
In reply to Ingo MolnarImpact: 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
--- 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(-)
arch/x86/kernel/setup.c +1 -0
@@ -885,6 +885,7 @@ void __init setup_arch(char **cmdline_p)#endif initmem_init (0 , max_pfn); + bootmem_state =DURING_BOOTMEM ;#ifdef CONFIG_ACPI_SLEEP /*
arch/x86/mm/init.c +7 -6
@@ -14,7 +14,7 @@ unsigned long __initdata e820_table_starunsigned long __meminitdata e820_table_end;unsigned long __meminitdata e820_table_top; -int after_bootmem; +enum bootmem_state bootmem_state =BEFORE_BOOTMEM ; int direct_gbpages#ifdef CONFIG_DIRECT_GBPAGES
@@ -206,7 +206,7 @@ unsigned long __init_refok init_memory_mprintk (KERN_INFO "init_memory_mapping: %016lx-%016lx\n" , start, end); -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )init_gbpages ();#if defined(CONFIG_DEBUG_PAGEALLOC ) || defined(CONFIG_KMEMCHECK )
@@ -342,7 +342,7 @@ unsigned long __init_refok init_memory_m* memory mapped. Unfortunately this is done currently before the * nodes are discovered. */ -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )find_early_table_space (end, use_pse, use_gbpages);#ifdef CONFIG_X86_32
@@ -363,16 +363,17 @@ unsigned long __init_refok init_memory_m#endif #ifdef CONFIG_X86_64 -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM ) mmu_cr4_features =read_cr4 ();#endif __flush_tlb_all (); -if (!after_bootmem && e820_table_end > e820_table_start) +if (bootmem_state ==BEFORE_BOOTMEM && + e820_table_end > e820_table_start)reserve_early (e820_table_start <<PAGE_SHIFT , e820_table_end <<PAGE_SHIFT ,"PGTABLE" ); -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )early_memtest (start, end);return ret >>PAGE_SHIFT ;
arch/x86/mm/init_32.c +20 -8
@@ -82,14 +82,20 @@ static __init void *alloc_low_page(void)static pmd_t *__init one_md_table_init (pgd_t *pgd) {pud_t *pud; -pmd_t *pmd_table; +pmd_t *pmd_table =NULL ;#ifdef CONFIG_X86_PAE if (!(pgd_val (*pgd) & _PAGE_PRESENT)) { -if (after_bootmem) +switch (bootmem_state) { +case DURING_BOOTMEM : pmd_table = (pmd_t *)alloc_bootmem_low_pages (PAGE_SIZE ); -else +break ; +case BEFORE_BOOTMEM : pmd_table = (pmd_t *)alloc_low_page (); +break ; +default : +panic ("after bootmem call one_md_table_init\n" ); + }paravirt_alloc_pmd (&init_mm,__pa (pmd_table) >>PAGE_SHIFT );set_pgd (pgd,__pgd (__pa (pmd_table) | _PAGE_PRESENT)); pud =pud_offset (pgd,0 );
@@ -113,15 +119,21 @@ static pte_t * __init one_page_table_iniif (!(pmd_val (*pmd) & _PAGE_PRESENT)) {pte_t *page_table =NULL ; -if (after_bootmem) { +switch (bootmem_state) { +case DURING_BOOTMEM :#if defined(CONFIG_DEBUG_PAGEALLOC ) || defined(CONFIG_KMEMCHECK ) page_table = (pte_t *)alloc_bootmem_pages (PAGE_SIZE );#endif if (!page_table) page_table = (pte_t *)alloc_bootmem_low_pages (PAGE_SIZE ); - }else +break ; +case BEFORE_BOOTMEM : page_table = (pte_t *)alloc_low_page (); +break ; +default : +panic ("after bootmem call one_page_table_init\n" ); + }paravirt_alloc_pte (&init_mm,__pa (page_table) >>PAGE_SHIFT );set_pmd (pmd,__pmd (__pa (page_table) | _PAGE_TABLE));
@@ -169,7 +181,7 @@ static pte_t *__init page_table_kmap_chepte_t *newpte;int i; -BUG_ON (after_bootmem); +BUG_ON (bootmem_state !=BEFORE_BOOTMEM ); newpte =alloc_low_page ();for (i =0 ; i <PTRS_PER_PTE ; i++)set_pte (newpte + i, pte[i]);
@@ -803,8 +815,6 @@ void __init setup_bootmem_allocator(void bootmap =setup_node_bootmem (nodeid, start_pfn, end_pfn, bootmap); } - - after_bootmem =1 ; }/*
@@ -871,6 +881,8 @@ void __init mem_init(void)/* this will put all low memory onto the freelists */ totalram_pages +=free_all_bootmem (); + bootmem_state =AFTER_BOOTMEM ; + reservedpages =0 ;for (tmp =0 ; tmp < max_low_pfn; tmp++)/*
arch/x86/mm/init_64.c +19 -14
@@ -107,20 +107,26 @@ __setup("noexec32=", nonx32_setup);/* * NOTE: This function is marked __ref because it calls __init function -* (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0. +* (alloc_bootmem_pages). It's safe to do it ONLY when DURING_BOOTMEM. */ static __ref void *spp_getpage (void ) { -void *ptr; +void *ptr =NULL ; -if (after_bootmem) +switch (bootmem_state) { +case AFTER_BOOTMEM : ptr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); -else +break ; +case DURING_BOOTMEM : ptr =alloc_bootmem_pages (PAGE_SIZE ); +break ; +default : +panic ("calling spp_getpage before bootmem\n" ); + }if (!ptr || ((unsigned long )ptr & ~PAGE_MASK )) {panic ("set_pte_phys: cannot allocate page data %s\n" , - after_bootmem ?"after bootmem" :"" ); + bootmem_state ==AFTER_BOOTMEM ?"after bootmem" :"" ); }pr_debug ("spp_getpage %p\n" , ptr);
@@ -287,16 +293,17 @@ void __init cleanup_highmap(void)static __ref void *alloc_low_page (unsigned long *phys) { -unsigned long pfn = e820_table_end++; +unsigned long pfn;void *adr; -if (after_bootmem) { +if (bootmem_state ==AFTER_BOOTMEM ) { adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); *phys =__pa (adr);return adr; } + pfn = e820_table_end++;if (pfn >= e820_table_top)panic ("alloc_low_page: ran out of memory" );
@@ -308,7 +315,7 @@ static __ref void *alloc_low_page(unsignstatic __ref void unmap_low_page (void *adr) { -if (after_bootmem) +if (bootmem_state ==AFTER_BOOTMEM )return ;early_iounmap (adr,PAGE_SIZE );
@@ -327,7 +334,7 @@ phys_pte_init(pte_t *pte_page, unsignedfor (i =pte_index (addr); i <PTRS_PER_PTE ; i++, addr +=PAGE_SIZE , pte++) {if (addr >= end) { -if (!after_bootmem) { +if (bootmem_state !=AFTER_BOOTMEM ) {for (; i <PTRS_PER_PTE ; i++, pte++)set_pte (pte,__pte (0 )); }
@@ -383,7 +390,7 @@ phys_pmd_init(pmd_t *pmd_page, unsignedpgprot_t new_prot = prot;if (address >= end) { -if (!after_bootmem) { +if (bootmem_state !=AFTER_BOOTMEM ) {for (; i <PTRS_PER_PMD ; i++, pmd++)set_pmd (pmd,__pmd (0 )); }
@@ -469,7 +476,7 @@ phys_pud_init(pud_t *pud_page, unsignedif (addr >= end)break ; -if (!after_bootmem && +if (bootmem_state !=AFTER_BOOTMEM && !e820_any_mapped (addr, addr+PUD_SIZE ,0 )) {set_pud (pud,__pud (0 ));continue ;
@@ -660,8 +667,6 @@ void __init mem_init(void)/* clear_bss() already clear the empty_zero_page */ - reservedpages =0 ; -/* this will put all low memory onto the freelists */ #ifdef CONFIG_NUMA totalram_pages =numa_free_all_bootmem ();
@@ -669,9 +674,9 @@ void __init mem_init(void) totalram_pages =free_all_bootmem ();#endif + bootmem_state =AFTER_BOOTMEM ; absent_pages =absent_pages_in_range (0 , max_pfn); reservedpages = max_pfn - totalram_pages - absent_pages; - after_bootmem =1 ; codesize = (unsigned long ) &_etext - (unsigned long ) &_text; datasize = (unsigned long ) &_edata - (unsigned long ) &_etext;
include/linux/mm.h +9 -0
@@ -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;#ifdef CONFIG_NUMA
Re: [PATCH] x86: introduce bootmem_state -v2
Quoted 26 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEMv2: style changes according to ingo
Signed-off-by Yinghai Lu <[email protected]>--- 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
===================================================================include/linux/mm.h +0
-0@@ -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);
include/linux/mm.h extern void __init mmap_init(void); · line 1079
Quoted 10 lines
include/linux/mm.h +9
-0+ +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.
Andrew, what would be your preference?
Ingo
Andrew Morton
maintainerRe: [PATCH] x86: introduce bootmem_state -v2
Quoted 43 lines · On Fri, 6 Mar 2009 20:12:49 +0100 Ingo Molnar <[email protected]> wrote:
Quoted 26 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEMv2: style changes according to ingo
Signed-off-by Yinghai Lu <[email protected]>--- 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
===================================================================include/linux/mm.h +0
-0@@ -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);include/linux/mm.h extern void __init mmap_init(void); · line 1079
Quoted 10 lines
include/linux/mm.h +9
-0+ +enum bootmem_state { +BEFORE_BOOTMEM , +DURING_BOOTMEM , +AFTER_BOOTMEM +}; + +extern enum bootmem_state bootmem_state; +extern int after_bootmem;Btw., the
after_bootmemvariable itself should either move to x86 (andarch/sh), or should be defined inmm/bootmem.c.
Quoted 5 lines
Right now we have this weird
mm.hconstruct that is not actually useful to generic code.Andrew, what would be your preference?
If two architectures are using it then it should be provided by core kernel?
This is obvious if the state transitions are occurring in core-kernel code, but if the transitions are happening in arch code then making it a core concept assumes consistency between different architectures which might not exist.
IOW: dunno.
Re: [PATCH] x86: introduce bootmem_state -v2
Quoted 55 lines · Andrew Morton
Quoted 43 lines · On Fri, 6 Mar 2009 20:12:49 +0100 Ingo Molnar <[email protected]> wrote:
Quoted 26 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEMv2: style changes according to ingo
Signed-off-by Yinghai Lu <[email protected]>--- 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
===================================================================include/linux/mm.h +0
-0@@ -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);include/linux/mm.h extern void __init mmap_init(void); · line 1079
Quoted 10 lines
include/linux/mm.h +9
-0+ +enum bootmem_state { +BEFORE_BOOTMEM , +DURING_BOOTMEM , +AFTER_BOOTMEM +}; + +extern enum bootmem_state bootmem_state; +extern int after_bootmem;Btw., the
after_bootmemvariable itself should either move to x86 (andarch/sh), or should be defined inmm/bootmem.c.Quoted 5 lines
Right now we have this weird
mm.hconstruct that is not actually useful to generic code.Andrew, what would be your preference?
If two architectures are using it then it should be provided by core kernel?
Quoted 6 lines
This is obvious if the state transitions are occurring in core-kernel code, but if the transitions are happening in arch code then making it a core concept assumes consistency between different architectures which might not exist.
IOW: dunno.
Core kernel could provide a wrapper allocator which calls the right method depending on which state we are in. It will call bootmem_alloc() if called early, and kmalloc() if called later. Or something like that. Would there be any utility in that?
Ingo
Re: [PATCH] x86: introduce bootmem_state -v2
Quoted 53 lines · Ingo Molnar
Quoted 50 lines · Andrew Morton
Quoted 46 lines · On Fri, 6 Mar 2009 20:12:49 +0100 Ingo Molnar <[email protected]> wrote:
Quoted 26 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEMv2: style changes according to ingo
Signed-off-by Yinghai Lu <[email protected]>--- 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
===================================================================include/linux/mm.h +1
-0@@ -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); +include/linux/mm.h extern void __init mmap_init(void); · line 1080
Quoted 10 lines
include/linux/mm.h +8
-0+enum bootmem_state { +BEFORE_BOOTMEM , +DURING_BOOTMEM , +AFTER_BOOTMEM +}; + +extern enum bootmem_state bootmem_state; +extern int after_bootmem;Btw., the
after_bootmemvariable itself should either move to x86 (andarch/sh), or should be defined inmm/bootmem.c.Right now we have this weird
mm.hconstruct that is not actually useful to generic code.Andrew, what would be your preference?
Quoted 9 lines
Quoted 6 lines
If two architectures are using it then it should be provided by core kernel?
This is obvious if the state transitions are occurring in core-kernel code, but if the transitions are happening in arch code then making it a core concept assumes consistency between different architectures which might not exist.
IOW: dunno.
Core kernel could provide a wrapper allocator which calls the right method depending on which state we are in. It will call
bootmem_alloc()if called early, andkmalloc()if called later. Or something like that. Would there be any utility in that?
Yes, so long as you're never intending to free the memory (since you won't know which free function to use for a given pointer - assuming one even exists). And code which does:
p = use_anytime_alloctor();
...
kfree(p); /* I know it was really allocated by kmalloc */
should be shot.
J
Re: [PATCH] x86: introduce bootmem_state -v2
In reply to Ingo MolnarQuoted 41 lines · Ingo Molnar
Quoted 25 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEMv2: style changes according to ingo
Signed-off-by Yinghai Lu <[email protected]>--- 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
===================================================================include/linux/mm.h +0
-0@@ -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);include/linux/mm.h extern void __init mmap_init(void); · line 1079
Quoted 10 lines
include/linux/mm.h +9
-0+ +enum bootmem_state { +BEFORE_BOOTMEM , +DURING_BOOTMEM , +AFTER_BOOTMEM +}; + +extern enum bootmem_state bootmem_state; +extern int after_bootmem;Btw., the
after_bootmemvariable itself should either move to x86 (andarch/sh), or should be defined inmm/bootmem.c.
Quoted 2 lines
Right now we have this weird
mm.hconstruct 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
YH
Re: [PATCH] x86: introduce bootmem_state -v2
Quoted 42 lines · Yinghai Lu
Quoted 41 lines · Ingo Molnar
Quoted 25 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEMv2: style changes according to ingo
Signed-off-by Yinghai Lu <[email protected]>--- 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
===================================================================include/linux/mm.h +0
-0@@ -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);include/linux/mm.h extern void __init mmap_init(void); · line 1079
Quoted 10 lines
include/linux/mm.h +9
-0+ +enum bootmem_state { +BEFORE_BOOTMEM , +DURING_BOOTMEM , +AFTER_BOOTMEM +}; + +extern enum bootmem_state bootmem_state; +extern int after_bootmem;Btw., the
after_bootmemvariable itself should either move to x86 (andarch/sh), or should be defined inmm/bootmem.c.
Quoted 6 lines
Quoted 2 lines
Right now we have this weird
mm.hconstruct that is not actually useful to generic code.with this patch, only sh is using
after_bootmem. could
1. make sh to usebootmem_state
2. then removeafter_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.
Ingo
Re: [PATCH] x86: introduce bootmem_state -v2
Quoted 48 lines · Ingo Molnar
Quoted 40 lines · Yinghai Lu
Quoted 39 lines · Ingo Molnar
Quoted 24 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEMv2: style changes according to ingo
Signed-off-by Yinghai Lu <[email protected]>--- 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
===================================================================include/linux/mm.h +0
-0@@ -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);include/linux/mm.h extern void __init mmap_init(void); · line 1079
Quoted 10 lines
include/linux/mm.h +9
-0+ +enum bootmem_state { +BEFORE_BOOTMEM , +DURING_BOOTMEM , +AFTER_BOOTMEM +}; + +extern enum bootmem_state bootmem_state; +extern int after_bootmem;Btw., the
after_bootmemvariable itself should either move to x86 (andarch/sh), or should be defined inmm/bootmem.c.Quoted 5 lines
Quoted 2 lines
Right now we have this weird
mm.hconstruct that is not actually useful to generic code.with this patch, only sh is using
after_bootmem. could
1. make sh to usebootmem_state
2. then removeafter_bootmem
Quoted 6 lines
Hm, lets leave
arch/shalone for now i think - the commits are desintd for the x86 tree.But we should move our
after_bootmemtoarch/x86/include/and not pollutemm.hwith 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.
YH
Re: [PATCH] x86: introduce bootmem_state -v2
Quoted 52 lines · Yinghai Lu
Quoted 51 lines · Ingo Molnar
Quoted 40 lines · Yinghai Lu
Quoted 39 lines · Ingo Molnar
Quoted 24 lines · Yinghai Lu
Impact: cleanup
extend
after_bootmemandafter_init_bootmemtobootmem_stateand will haveBEFORE_BOOTMEM,DURING_BOOTMEM,AFTER_BOOTMEMv2: style changes according to ingo
Signed-off-by Yinghai Lu <[email protected]>--- 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
===================================================================include/linux/mm.h +0
-0@@ -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);include/linux/mm.h extern void __init mmap_init(void); · line 1079
Quoted 10 lines
include/linux/mm.h +9
-0+ +enum bootmem_state { +BEFORE_BOOTMEM , +DURING_BOOTMEM , +AFTER_BOOTMEM +}; + +extern enum bootmem_state bootmem_state; +extern int after_bootmem;Btw., the
after_bootmemvariable itself should either move to x86 (andarch/sh), or should be defined inmm/bootmem.c.Quoted 5 lines
Quoted 2 lines
Right now we have this weird
mm.hconstruct that is not actually useful to generic code.with this patch, only sh is using
after_bootmem. could
1. make sh to usebootmem_state
2. then removeafter_bootmemHm, lets leave
arch/shalone for now i think - the commits are desintd for the x86 tree.
Quoted 6 lines
Quoted 3 lines
But we should move our
after_bootmemtoarch/x86/include/and not pollutemm.hwith it. It's an x86 internal detail for now.you mean move
bootmem_statetoarch/x86/include? with this patch are not usingafter_bootmemanymore.
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
PATCH 1/1 x86: introduce bootmem_state -v3
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
v3: move bootmem_state declaring to arch/x86/include
--- arch/x86/include/asm/page_types.h | 8 ++++++++ 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 +++++++++++++++++++-------------- 5 files changed, 55 insertions(+), 28 deletions(-)
arch/x86/kernel/setup.c +1 -0
@@ -885,6 +885,7 @@ void __init setup_arch(char **cmdline_p)#endif initmem_init (0 , max_pfn); + bootmem_state =DURING_BOOTMEM ;#ifdef CONFIG_ACPI_SLEEP /*
arch/x86/mm/init.c +7 -6
@@ -14,7 +14,7 @@ unsigned long __initdata e820_table_starunsigned long __meminitdata e820_table_end;unsigned long __meminitdata e820_table_top; -int after_bootmem; +enum bootmem_state bootmem_state =BEFORE_BOOTMEM ; int direct_gbpages#ifdef CONFIG_DIRECT_GBPAGES
@@ -206,7 +206,7 @@ unsigned long __init_refok init_memory_mprintk (KERN_INFO "init_memory_mapping: %016lx-%016lx\n" , start, end); -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )init_gbpages ();#if defined(CONFIG_DEBUG_PAGEALLOC ) || defined(CONFIG_KMEMCHECK )
@@ -342,7 +342,7 @@ unsigned long __init_refok init_memory_m* memory mapped. Unfortunately this is done currently before the * nodes are discovered. */ -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )find_early_table_space (end, use_pse, use_gbpages);#ifdef CONFIG_X86_32
@@ -363,16 +363,17 @@ unsigned long __init_refok init_memory_m#endif #ifdef CONFIG_X86_64 -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM ) mmu_cr4_features =read_cr4 ();#endif __flush_tlb_all (); -if (!after_bootmem && e820_table_end > e820_table_start) +if (bootmem_state ==BEFORE_BOOTMEM && + e820_table_end > e820_table_start)reserve_early (e820_table_start <<PAGE_SHIFT , e820_table_end <<PAGE_SHIFT ,"PGTABLE" ); -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )early_memtest (start, end);return ret >>PAGE_SHIFT ;
arch/x86/mm/init_32.c +20 -8
@@ -82,14 +82,20 @@ static __init void *alloc_low_page(void)static pmd_t *__init one_md_table_init (pgd_t *pgd) {pud_t *pud; -pmd_t *pmd_table; +pmd_t *pmd_table =NULL ;#ifdef CONFIG_X86_PAE if (!(pgd_val (*pgd) & _PAGE_PRESENT)) { -if (after_bootmem) +switch (bootmem_state) { +case DURING_BOOTMEM : pmd_table = (pmd_t *)alloc_bootmem_low_pages (PAGE_SIZE ); -else +break ; +case BEFORE_BOOTMEM : pmd_table = (pmd_t *)alloc_low_page (); +break ; +default : +panic ("after bootmem call one_md_table_init\n" ); + }paravirt_alloc_pmd (&init_mm,__pa (pmd_table) >>PAGE_SHIFT );set_pgd (pgd,__pgd (__pa (pmd_table) | _PAGE_PRESENT)); pud =pud_offset (pgd,0 );
@@ -113,15 +119,21 @@ static pte_t * __init one_page_table_iniif (!(pmd_val (*pmd) & _PAGE_PRESENT)) {pte_t *page_table =NULL ; -if (after_bootmem) { +switch (bootmem_state) { +case DURING_BOOTMEM :#if defined(CONFIG_DEBUG_PAGEALLOC ) || defined(CONFIG_KMEMCHECK ) page_table = (pte_t *)alloc_bootmem_pages (PAGE_SIZE );#endif if (!page_table) page_table = (pte_t *)alloc_bootmem_low_pages (PAGE_SIZE ); - }else +break ; +case BEFORE_BOOTMEM : page_table = (pte_t *)alloc_low_page (); +break ; +default : +panic ("after bootmem call one_page_table_init\n" ); + }paravirt_alloc_pte (&init_mm,__pa (page_table) >>PAGE_SHIFT );set_pmd (pmd,__pmd (__pa (page_table) | _PAGE_TABLE));
@@ -169,7 +181,7 @@ static pte_t *__init page_table_kmap_chepte_t *newpte;int i; -BUG_ON (after_bootmem); +BUG_ON (bootmem_state !=BEFORE_BOOTMEM ); newpte =alloc_low_page ();for (i =0 ; i <PTRS_PER_PTE ; i++)set_pte (newpte + i, pte[i]);
@@ -803,8 +815,6 @@ void __init setup_bootmem_allocator(void bootmap =setup_node_bootmem (nodeid, start_pfn, end_pfn, bootmap); } - - after_bootmem =1 ; }/*
@@ -871,6 +881,8 @@ void __init mem_init(void)/* this will put all low memory onto the freelists */ totalram_pages +=free_all_bootmem (); + bootmem_state =AFTER_BOOTMEM ; + reservedpages =0 ;for (tmp =0 ; tmp < max_low_pfn; tmp++)/*
arch/x86/mm/init_64.c +19 -14
@@ -107,20 +107,26 @@ __setup("noexec32=", nonx32_setup);/* * NOTE: This function is marked __ref because it calls __init function -* (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0. +* (alloc_bootmem_pages). It's safe to do it ONLY when DURING_BOOTMEM. */ static __ref void *spp_getpage (void ) { -void *ptr; +void *ptr =NULL ; -if (after_bootmem) +switch (bootmem_state) { +case AFTER_BOOTMEM : ptr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); -else +break ; +case DURING_BOOTMEM : ptr =alloc_bootmem_pages (PAGE_SIZE ); +break ; +default : +panic ("calling spp_getpage before bootmem\n" ); + }if (!ptr || ((unsigned long )ptr & ~PAGE_MASK )) {panic ("set_pte_phys: cannot allocate page data %s\n" , - after_bootmem ?"after bootmem" :"" ); + bootmem_state ==AFTER_BOOTMEM ?"after bootmem" :"" ); }pr_debug ("spp_getpage %p\n" , ptr);
@@ -287,16 +293,17 @@ void __init cleanup_highmap(void)static __ref void *alloc_low_page (unsigned long *phys) { -unsigned long pfn = e820_table_end++; +unsigned long pfn;void *adr; -if (after_bootmem) { +if (bootmem_state ==AFTER_BOOTMEM ) { adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); *phys =__pa (adr);return adr; } + pfn = e820_table_end++;if (pfn >= e820_table_top)panic ("alloc_low_page: ran out of memory" );
@@ -308,7 +315,7 @@ static __ref void *alloc_low_page(unsignstatic __ref void unmap_low_page (void *adr) { -if (after_bootmem) +if (bootmem_state ==AFTER_BOOTMEM )return ;early_iounmap (adr,PAGE_SIZE );
@@ -327,7 +334,7 @@ phys_pte_init(pte_t *pte_page, unsignedfor (i =pte_index (addr); i <PTRS_PER_PTE ; i++, addr +=PAGE_SIZE , pte++) {if (addr >= end) { -if (!after_bootmem) { +if (bootmem_state !=AFTER_BOOTMEM ) {for (; i <PTRS_PER_PTE ; i++, pte++)set_pte (pte,__pte (0 )); }
@@ -383,7 +390,7 @@ phys_pmd_init(pmd_t *pmd_page, unsignedpgprot_t new_prot = prot;if (address >= end) { -if (!after_bootmem) { +if (bootmem_state !=AFTER_BOOTMEM ) {for (; i <PTRS_PER_PMD ; i++, pmd++)set_pmd (pmd,__pmd (0 )); }
@@ -469,7 +476,7 @@ phys_pud_init(pud_t *pud_page, unsignedif (addr >= end)break ; -if (!after_bootmem && +if (bootmem_state !=AFTER_BOOTMEM && !e820_any_mapped (addr, addr+PUD_SIZE ,0 )) {set_pud (pud,__pud (0 ));continue ;
@@ -660,8 +667,6 @@ void __init mem_init(void)/* clear_bss() already clear the empty_zero_page */ - reservedpages =0 ; -/* this will put all low memory onto the freelists */ #ifdef CONFIG_NUMA totalram_pages =numa_free_all_bootmem ();
@@ -669,9 +674,9 @@ void __init mem_init(void) totalram_pages =free_all_bootmem ();#endif + bootmem_state =AFTER_BOOTMEM ; absent_pages =absent_pages_in_range (0 , max_pfn); reservedpages = max_pfn - totalram_pages - absent_pages; - after_bootmem =1 ; codesize = (unsigned long ) &_etext - (unsigned long ) &_text; datasize = (unsigned long ) &_edata - (unsigned long ) &_etext;
arch/x86/include/asm/page_types.h +8 -0
@@ -40,6 +40,14 @@#ifndef __ASSEMBLY__ +enum bootmem_state { +BEFORE_BOOTMEM , +DURING_BOOTMEM , +AFTER_BOOTMEM +}; + +extern enum bootmem_state bootmem_state; +extern int page_is_ram (unsigned long pagenr);extern int devmem_is_allowed (unsigned long pagenr);
[tip:kmemcheck] x86: introduce bootmem_state
Commit-ID: 4c76c04421dfe7be3e5a1d8ab1b2a3be0b02558e Gitweb: http://git.kernel.org/tip/4c76c04421dfe7be3e5a1d8ab1b2a3be0b02558e Author: "Yinghai Lu" <[email protected]> AuthorDate: Fri, 6 Mar 2009 16:49:00 -0800 Commit: Ingo Molnar <[email protected]> CommitDate: Sun, 8 Mar 2009 19:43:09 +0100
x86: introduce bootmem_state
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
v3: move bootmem_state declaring to arch/x86/include
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/page_types.h | 8 ++++++++ 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 +++++++++++++++++++-------------- 5 files changed, 55 insertions(+), 28 deletions(-)
arch/x86/include/asm/page_types.h +8 -0
@@ -40,6 +40,14 @@#ifndef __ASSEMBLY__ +enum bootmem_state { +BEFORE_BOOTMEM , +DURING_BOOTMEM , +AFTER_BOOTMEM +}; + +extern enum bootmem_state bootmem_state; +extern int page_is_ram (unsigned long pagenr);extern int devmem_is_allowed (unsigned long pagenr);
arch/x86/kernel/setup.c +1 -0
@@ -885,6 +885,7 @@ void __init setup_arch(char **cmdline_p)#endif initmem_init (0 , max_pfn); + bootmem_state =DURING_BOOTMEM ;#ifdef CONFIG_ACPI_SLEEP /*
arch/x86/mm/init.c +7 -6
@@ -14,7 +14,7 @@ unsigned long __initdata e820_table_start;unsigned long __meminitdata e820_table_end;unsigned long __meminitdata e820_table_top; -int after_bootmem; +enum bootmem_state bootmem_state =BEFORE_BOOTMEM ; int direct_gbpages#ifdef CONFIG_DIRECT_GBPAGES
@@ -143,7 +143,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,printk (KERN_INFO "init_memory_mapping: %016lx-%016lx\n" , start, end); -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )init_gbpages ();#if defined(CONFIG_DEBUG_PAGEALLOC ) || defined(CONFIG_KMEMCHECK )
@@ -283,7 +283,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,* memory mapped. Unfortunately this is done currently before the * nodes are discovered. */ -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )find_early_table_space (end, use_pse, use_gbpages);#ifdef CONFIG_X86_32
@@ -304,16 +304,17 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,#endif #ifdef CONFIG_X86_64 -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM ) mmu_cr4_features =read_cr4 ();#endif __flush_tlb_all (); -if (!after_bootmem && e820_table_end > e820_table_start) +if (bootmem_state ==BEFORE_BOOTMEM && + e820_table_end > e820_table_start)reserve_early (e820_table_start <<PAGE_SHIFT , e820_table_end <<PAGE_SHIFT ,"PGTABLE" ); -if (!after_bootmem) +if (bootmem_state ==BEFORE_BOOTMEM )early_memtest (start, end);return ret >>PAGE_SHIFT ;
arch/x86/mm/init_32.c +20 -8
@@ -82,14 +82,20 @@ static __init void *alloc_low_page(void)static pmd_t *__init one_md_table_init (pgd_t *pgd) {pud_t *pud; -pmd_t *pmd_table; +pmd_t *pmd_table =NULL ;#ifdef CONFIG_X86_PAE if (!(pgd_val (*pgd) & _PAGE_PRESENT)) { -if (after_bootmem) +switch (bootmem_state) { +case DURING_BOOTMEM : pmd_table = (pmd_t *)alloc_bootmem_low_pages (PAGE_SIZE ); -else +break ; +case BEFORE_BOOTMEM : pmd_table = (pmd_t *)alloc_low_page (); +break ; +default : +panic ("after bootmem call one_md_table_init\n" ); + }paravirt_alloc_pmd (&init_mm,__pa (pmd_table) >>PAGE_SHIFT );set_pgd (pgd,__pgd (__pa (pmd_table) | _PAGE_PRESENT)); pud =pud_offset (pgd,0 );
@@ -113,15 +119,21 @@ static pte_t * __init one_page_table_init(pmd_t *pmd)if (!(pmd_val (*pmd) & _PAGE_PRESENT)) {pte_t *page_table =NULL ; -if (after_bootmem) { +switch (bootmem_state) { +case DURING_BOOTMEM :#if defined(CONFIG_DEBUG_PAGEALLOC ) || defined(CONFIG_KMEMCHECK ) page_table = (pte_t *)alloc_bootmem_pages (PAGE_SIZE );#endif if (!page_table) page_table = (pte_t *)alloc_bootmem_low_pages (PAGE_SIZE ); - }else +break ; +case BEFORE_BOOTMEM : page_table = (pte_t *)alloc_low_page (); +break ; +default : +panic ("after bootmem call one_page_table_init\n" ); + }paravirt_alloc_pte (&init_mm,__pa (page_table) >>PAGE_SHIFT );set_pmd (pmd,__pmd (__pa (page_table) | _PAGE_TABLE));
@@ -169,7 +181,7 @@ static pte_t *__init page_table_kmap_check(pte_t *pte, pmd_t *pmd,pte_t *newpte;int i; -BUG_ON (after_bootmem); +BUG_ON (bootmem_state !=BEFORE_BOOTMEM ); newpte =alloc_low_page ();for (i =0 ; i <PTRS_PER_PTE ; i++)set_pte (newpte + i, pte[i]);
@@ -855,8 +867,6 @@ void __init setup_bootmem_allocator(void) bootmap =setup_node_bootmem (nodeid, start_pfn, end_pfn, bootmap); } - - after_bootmem =1 ; }/*
@@ -923,6 +933,8 @@ void __init mem_init(void)/* this will put all low memory onto the freelists */ totalram_pages +=free_all_bootmem (); + bootmem_state =AFTER_BOOTMEM ; + reservedpages =0 ;for (tmp =0 ; tmp < max_low_pfn; tmp++)/*
arch/x86/mm/init_64.c +19 -14
@@ -140,20 +140,26 @@ __setup("noexec32=", nonx32_setup);/* * NOTE: This function is marked __ref because it calls __init function -* (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0. +* (alloc_bootmem_pages). It's safe to do it ONLY when DURING_BOOTMEM. */ static __ref void *spp_getpage (void ) { -void *ptr; +void *ptr =NULL ; -if (after_bootmem) +switch (bootmem_state) { +case AFTER_BOOTMEM : ptr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); -else +break ; +case DURING_BOOTMEM : ptr =alloc_bootmem_pages (PAGE_SIZE ); +break ; +default : +panic ("calling spp_getpage before bootmem\n" ); + }if (!ptr || ((unsigned long )ptr & ~PAGE_MASK )) {panic ("set_pte_phys: cannot allocate page data %s\n" , - after_bootmem ?"after bootmem" :"" ); + bootmem_state ==AFTER_BOOTMEM ?"after bootmem" :"" ); }pr_debug ("spp_getpage %p\n" , ptr);
@@ -320,16 +326,17 @@ void __init cleanup_highmap(void)static __ref void *alloc_low_page (unsigned long *phys) { -unsigned long pfn = e820_table_end++; +unsigned long pfn;void *adr; -if (after_bootmem) { +if (bootmem_state ==AFTER_BOOTMEM ) { adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); *phys =__pa (adr);return adr; } + pfn = e820_table_end++;if (pfn >= e820_table_top)panic ("alloc_low_page: ran out of memory" );
@@ -341,7 +348,7 @@ static __ref void *alloc_low_page(unsigned long *phys)static __ref void unmap_low_page (void *adr) { -if (after_bootmem) +if (bootmem_state ==AFTER_BOOTMEM )return ;early_iounmap (adr,PAGE_SIZE );
@@ -360,7 +367,7 @@ phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end,for (i =pte_index (addr); i <PTRS_PER_PTE ; i++, addr +=PAGE_SIZE , pte++) {if (addr >= end) { -if (!after_bootmem) { +if (bootmem_state !=AFTER_BOOTMEM ) {for (; i <PTRS_PER_PTE ; i++, pte++)set_pte (pte,__pte (0 )); }
@@ -416,7 +423,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,pgprot_t new_prot = prot;if (address >= end) { -if (!after_bootmem) { +if (bootmem_state !=AFTER_BOOTMEM ) {for (; i <PTRS_PER_PMD ; i++, pmd++)set_pmd (pmd,__pmd (0 )); }
@@ -502,7 +509,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,if (addr >= end)break ; -if (!after_bootmem && +if (bootmem_state !=AFTER_BOOTMEM && !e820_any_mapped (addr, addr+PUD_SIZE ,0 )) {set_pud (pud,__pud (0 ));continue ;
@@ -693,8 +700,6 @@ void __init mem_init(void)/* clear_bss() already clear the empty_zero_page */ - reservedpages =0 ; -/* this will put all low memory onto the freelists */ #ifdef CONFIG_NUMA totalram_pages =numa_free_all_bootmem ();
@@ -702,9 +707,9 @@ void __init mem_init(void) totalram_pages =free_all_bootmem ();#endif + bootmem_state =AFTER_BOOTMEM ; absent_pages =absent_pages_in_range (0 , max_pfn); reservedpages = max_pfn - totalram_pages - absent_pages; - after_bootmem =1 ; codesize = (unsigned long ) &_etext - (unsigned long ) &_text; datasize = (unsigned long ) &_edata - (unsigned long ) &_etext;
Re: [tip:kmemcheck] x86: introduce bootmem_state
Quoted 10 lines · Yinghai Lu
Commit-ID: 4c76c04421dfe7be3e5a1d8ab1b2a3be0b02558e Gitweb: http://git.kernel.org/tip/4c76c04421dfe7be3e5a1d8ab1b2a3be0b02558e Author: "Yinghai Lu" <[email protected]> AuthorDate: Fri, 6 Mar 2009 16:49:00 -0800 Commit: Ingo Molnar <[email protected]> CommitDate: Sun, 8 Mar 2009 19:43:09 +0100x86: introduce
bootmem_stateImpact: cleanup
Note, this cleanup ended up in the tip:kmemcheck branch because it modifies the same code so there's dependencies.
Ingo
Re: [tip:kmemcheck] x86: introduce bootmem_state
Quoted 10 lines · Ingo Molnar
Quoted 7 lines · Yinghai Lu
Commit-ID: 4c76c04421dfe7be3e5a1d8ab1b2a3be0b02558e
Gitweb: http://git.kernel.org/tip/4c76c04421dfe7be3e5a1d8ab1b2a3be0b02558e
Author: "Yinghai Lu" <[email protected]>
AuthorDate: Fri, 6 Mar 2009 16:49:00 -0800
Commit: Ingo Molnar <[email protected]>
CommitDate: Sun, 8 Mar 2009 19:43:09 +0100
Quoted 6 lines
Quoted 3 lines
x86: introduce
bootmem_stateImpact: cleanup
Note, this cleanup ended up in the tip:kmemcheck branch because it modifies the same code so there's dependencies.
not sure. it seems it should be with tip/x86/mm
YH
Re: [tip:kmemcheck] x86: introduce bootmem_state
Quoted 11 lines · Yinghai Lu
Quoted 10 lines · Ingo Molnar
Quoted 7 lines · Yinghai Lu
Commit-ID: 4c76c04421dfe7be3e5a1d8ab1b2a3be0b02558e
Gitweb: http://git.kernel.org/tip/4c76c04421dfe7be3e5a1d8ab1b2a3be0b02558e
Author: "Yinghai Lu" <[email protected]>
AuthorDate: Fri, 6 Mar 2009 16:49:00 -0800
Commit: Ingo Molnar <[email protected]>
CommitDate: Sun, 8 Mar 2009 19:43:09 +0100
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
x86: introduce
bootmem_stateImpact: cleanup
Note, this cleanup ended up in the tip:kmemcheck branch because it modifies the same code so there's dependencies.
not sure. it seems it should be with tip/x86/mm
kmemcheck has the latest changes to that area and it has x86/mm merged too.
Ingo