x86, mm: Use MAX_DMA_PFN for ZONE_DMA on 32-bit
PATCH 1/7 x86, mm: Use MAX_DMA_PFN for ZONE_DMA on 32-bit
Use MAX_DMA_PFN which represents the 16 MB ISA DMA limit on 32-bit x86 just like we do on 64-bit.
--- arch/x86/mm/init_32.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
arch/x86/mm/init_32.c +1 -2
@@ -679,8 +679,7 @@ static void __init zone_sizes_init(void)unsigned long max_zone_pfns[MAX_NR_ZONES ];memset (max_zone_pfns,0 ,sizeof (max_zone_pfns));#ifdef CONFIG_ZONE_DMA - max_zone_pfns[ZONE_DMA ] = -virt_to_phys ((char *)MAX_DMA_ADDRESS ) >>PAGE_SHIFT ; + max_zone_pfns[ZONE_DMA ] =MAX_DMA_PFN ;#endif max_zone_pfns[ZONE_NORMAL ] = max_low_pfn;#ifdef CONFIG_HIGHMEM
Signature · 1 line
1.7.6.4
PATCH 2/7 x86, mm: Move zone init from paging_init() on 64-bit
This patch introduces a zone_sizes_init() helper function on 64-bit to make it more similar to 32-bit init.
--- arch/x86/mm/init_64.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
arch/x86/mm/init_64.c +7 -2
@@ -612,7 +612,7 @@ void __init initmem_init(void) }#endif -void __init paging_init (void ) +static void __init zone_sizes_init (void ) {unsigned long max_zone_pfns[MAX_NR_ZONES ];
@@ -623,6 +623,11 @@ void __init paging_init(void) max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ; max_zone_pfns[ZONE_NORMAL ] = max_pfn; +free_area_init_nodes (max_zone_pfns); +} + +void __init paging_init (void ) +{sparse_memory_present_with_active_regions (MAX_NUMNODES );sparse_init ();
@@ -634,7 +639,7 @@ void __init paging_init(void)*/ node_clear_state (0 ,N_NORMAL_MEMORY ); -free_area_init_nodes (max_zone_pfns); +zone_sizes_init (); }/*
Signature · 1 line
1.7.6.4
Re: [RFC/PATCH 2/7] x86, mm: Move zone init from paging_init() on 64-bit
Quoted 8 lines · Pekka Enberg
This patch introduces a
zone_sizes_init()helper function on 64-bit to make it more similar to 32-bit init.Cc Tejun Heo <[email protected]>Cc Yinghai Lu <[email protected]>Cc H. Peter Anvin <[email protected]>Cc David Rientjes <[email protected]>Signed-off-by Pekka Enberg <[email protected]>
PATCH 3/7 x86, mm: Use max_pfn instead of highend_pfn
In reply to Pekka EnbergThe 'highend_pfn' variable is always set to 'max_pfn' so just use the latter directly.
--- arch/x86/mm/init_32.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
arch/x86/mm/init_32.c +6 -6
@@ -54,7 +54,7 @@#include <asm/page_types.h> #include <asm/init.h> -unsigned long highstart_pfn, highend_pfn; +unsigned long highstart_pfn; static noinline int do_test_wp_bit(void);
@@ -647,14 +647,14 @@ void __init find_low_pfn_range(void)void __init initmem_init (void ) {#ifdef CONFIG_HIGHMEM - highstart_pfn = highend_pfn = max_pfn; + highstart_pfn = max_pfn;if (max_pfn > max_low_pfn) highstart_pfn = max_low_pfn; -memblock_x86_register_active_regions (0 ,0 , highend_pfn); +memblock_x86_register_active_regions (0 ,0 , max_pfn);sparse_memory_present_with_active_regions (0 );printk (KERN_NOTICE "%ldMB HIGHMEM available.\n" , -pages_to_mb (highend_pfn - highstart_pfn)); - num_physpages = highend_pfn; +pages_to_mb (max_pfn - highstart_pfn)); + num_physpages = max_pfn; high_memory = (void *)__va (highstart_pfn *PAGE_SIZE -1 ) +1 ;#else memblock_x86_register_active_regions (0 ,0 , max_low_pfn);
@@ -683,7 +683,7 @@ static void __init zone_sizes_init(void)#endif max_zone_pfns[ZONE_NORMAL ] = max_low_pfn;#ifdef CONFIG_HIGHMEM - max_zone_pfns[ZONE_HIGHMEM ] = highend_pfn; + max_zone_pfns[ZONE_HIGHMEM ] = max_pfn;#endif free_area_init_nodes (max_zone_pfns);
Signature · 1 line
1.7.6.4
Re: [RFC/PATCH 3/7] x86, mm: Use max_pfn instead of highend_pfn
arch/x86/mm/init_32.c line 60
Quoted 13 lines · Pekka Enberg
arch/x86/mm/init_32.c +1
-1@@ -54,7 +54,7 @@#include <asm/page_types.h> #include <asm/init.h> -unsigned long highstart_pfn, highend_pfn; +unsigned long highstart_pfn; static noinline int do_test_wp_bit(void);
This shouldn't build with a CONFIG_NUMA i386 config, highend_pfn is used in arch/x86/mm/numa_32.c.
Re: [RFC/PATCH 3/7] x86, mm: Use max_pfn instead of highend_pfn
Quoted 4 lines · David Rientjes
Quoted 4 lines
arch/x86/mm/init_32.c +0
-0@@ -54,7 +54,7 @@ #include <asm/page_types.h> #include <asm/init.h>
Quoted 8 lines
arch/x86/mm/init_32.c line 60
Quoted 5 lines
arch/x86/mm/init_32.c +1
-1-unsigned long highstart_pfn, highend_pfn; +unsigned long highstart_pfn; static noinline int do_test_wp_bit(void);This shouldn't build with a
CONFIG_NUMAi386 config,highend_pfnis used inarch/x86/mm/numa_32.c.
Fixed, thanks!
PATCH 4/7 x86, mm: Wrap ZONE_DMA32 with CONFIG_ZONE_DMA32
In reply to Pekka EnbergIn preparation for unifying 32-bit and 64-bit zone_sizes_init() make sure ZONE_DMA32 is wrapped in CONFIG_ZONE_DMA32.
--- arch/x86/mm/init_64.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/mm/init_64.c +2 -0
@@ -620,7 +620,9 @@ static void __init zone_sizes_init(void)#ifdef CONFIG_ZONE_DMA max_zone_pfns[ZONE_DMA ] =MAX_DMA_PFN ;#endif +#ifdef CONFIG_ZONE_DMA32 max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ; +#endif max_zone_pfns[ZONE_NORMAL ] = max_pfn;free_area_init_nodes (max_zone_pfns);
Signature · 1 line
1.7.6.4
Re: [RFC/PATCH 4/7] x86, mm: Wrap ZONE_DMA32 with CONFIG_ZONE_DMA32
Quoted 8 lines · Pekka Enberg
In preparation for unifying 32-bit and 64-bit
zone_sizes_init()make sureZONE_DMA32is wrapped inCONFIG_ZONE_DMA32.Cc Tejun Heo <[email protected]>Cc Yinghai Lu <[email protected]>Cc H. Peter Anvin <[email protected]>Cc David Rientjes <[email protected]>Signed-off-by Pekka Enberg <[email protected]>
Adding Arun Sharma to the cc, he was interested in disabling CONFIG_ZONE_DMA32 and I believe carries this patch internally (as we do).
Quoted 18 lines
--- arch/x86/mm/init_64.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/x86/mm/init_64.c +2
-0@@ -620,7 +620,9 @@ static void __init zone_sizes_init(void)#ifdef CONFIG_ZONE_DMA max_zone_pfns[ZONE_DMA ] =MAX_DMA_PFN ;#endif +#ifdef CONFIG_ZONE_DMA32 max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ; +#endif max_zone_pfns[ZONE_NORMAL ] = max_pfn;free_area_init_nodes (max_zone_pfns);
Arun Sharma
Acked-byRe: [RFC/PATCH 4/7] x86, mm: Wrap ZONE_DMA32 with CONFIG_ZONE_DMA32
Quoted 11 lines · David Rientjes
Quoted 8 lines · Pekka Enberg
In preparation for unifying 32-bit and 64-bit
zone_sizes_init()make sureZONE_DMA32is wrapped inCONFIG_ZONE_DMA32.Cc Tejun Heo<[email protected]>Cc Yinghai Lu<[email protected]>Cc H. Peter Anvin<[email protected]>Cc David Rientjes<[email protected]>Signed-off-by Pekka Enberg<[email protected]>
Quoted 5 lines
Acked-by David Rientjes<[email protected]>Adding Arun Sharma to the cc, he was interested in disabling
CONFIG_ZONE_DMA32and I believe carries this patch internally (as we do).
Yes we do.
PATCH 5/7 x86, mm: Use max_low_pfn for ZONE_NORMAL on 64-bit
In reply to Pekka Enberg64-bit has no highmem so max_low_pfn is always the same as 'max_pfn'.
--- arch/x86/mm/init_64.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/mm/init_64.c +1 -1
@@ -623,7 +623,7 @@ static void __init zone_sizes_init(void)#ifdef CONFIG_ZONE_DMA32 max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ;#endif - max_zone_pfns[ZONE_NORMAL ] = max_pfn; + max_zone_pfns[ZONE_NORMAL ] = max_low_pfn;free_area_init_nodes (max_zone_pfns); }
Signature · 1 line
1.7.6.4
Re: [RFC/PATCH 5/7] x86, mm: Use max_low_pfn for ZONE_NORMAL on 64-bit
Quoted 7 lines · Pekka Enberg
64-bit has no highmem so
max_low_pfnis always the same as 'max_pfn'.Cc Tejun Heo <[email protected]>Cc Yinghai Lu <[email protected]>Cc H. Peter Anvin <[email protected]>Cc David Rientjes <[email protected]>Signed-off-by Pekka Enberg <[email protected]>
PATCH 6/7 x86, mm: Prepare zone_sizes_init() for unification
In reply to Pekka EnbergMake 32-bit and 64-bit zone_sizes_init() identical in preparation for unification.
--- arch/x86/mm/init_32.c | 4 ++++ arch/x86/mm/init_64.c | 3 +++ 2 files changed, 7 insertions(+), 0 deletions(-)
arch/x86/mm/init_32.c +4 -0
@@ -677,10 +677,14 @@ void __init initmem_init(void)static void __init zone_sizes_init (void ) {unsigned long max_zone_pfns[MAX_NR_ZONES ]; +memset (max_zone_pfns,0 ,sizeof (max_zone_pfns));#ifdef CONFIG_ZONE_DMA max_zone_pfns[ZONE_DMA ] =MAX_DMA_PFN ;#endif +#ifdef CONFIG_ZONE_DMA32 + max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ; +#endif max_zone_pfns[ZONE_NORMAL ] = max_low_pfn;#ifdef CONFIG_HIGHMEM max_zone_pfns[ZONE_HIGHMEM ] = max_pfn;
arch/x86/mm/init_64.c +3 -0
@@ -624,6 +624,9 @@ static void __init zone_sizes_init(void) max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ;#endif max_zone_pfns[ZONE_NORMAL ] = max_low_pfn; +#ifdef CONFIG_HIGHMEM + max_zone_pfns[ZONE_HIGHMEM ] = max_pfn; +#endif free_area_init_nodes (max_zone_pfns); }
Signature · 1 line
1.7.6.4
Re: [RFC/PATCH 6/7] x86, mm: Prepare zone_sizes_init() for unification
Quoted 24 lines · Pekka Enberg
arch/x86/mm/init_32.c +4
-0@@ -677,10 +677,14 @@ void __init initmem_init(void)static void __init zone_sizes_init (void ) {unsigned long max_zone_pfns[MAX_NR_ZONES ]; +memset (max_zone_pfns,0 ,sizeof (max_zone_pfns));#ifdef CONFIG_ZONE_DMA max_zone_pfns[ZONE_DMA ] =MAX_DMA_PFN ;#endif +#ifdef CONFIG_ZONE_DMA32 + max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ; +#endif max_zone_pfns[ZONE_NORMAL ] = max_low_pfn;#ifdef CONFIG_HIGHMEM max_zone_pfns[ZONE_HIGHMEM ] = max_pfn;arch/x86/mm/init_64.c +0
-0
arch/x86/mm/init_64.c static void __init zone_sizes_init(void) · line 632
Quoted 9 lines
arch/x86/mm/init_64.c +3
-0@@ -624,6 +624,9 @@ static void __init zone_sizes_init(void) max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ;#endif max_zone_pfns[ZONE_NORMAL ] = max_low_pfn; +#ifdef CONFIG_HIGHMEM + max_zone_pfns[ZONE_HIGHMEM ] = max_pfn; +#endif free_area_init_nodes (max_zone_pfns); }
I'd just fold patch 7 into this, it doesn't make much sense to have add CONFIG_HIGHMEM code for 64-bit, for example, just to make the next patch simpler.
Re: [RFC/PATCH 6/7] x86, mm: Prepare zone_sizes_init() for unification
Hi David,
Quoted 3 lines · David Rientjes
I'd just fold patch 7 into this, it doesn't make much sense to have add
CONFIG_HIGHMEMcode for 64-bit, for example, just to make the next patch simpler.
Actually, I don't agree.
Whenever I've done unification patches, I've always made sure the patch that does the actual unification is just code shuffling. That improves bisectability and makes reviewing easier.
Pekka
PATCH 7/7 x86, mm: Unify zone_sizes_init()
In reply to Pekka EnbergNow that zone_sizes_init() is identical on 32-bit and 64-bit, move the code to arch/x86/mm/init.c and use it for both architectures.
--- arch/x86/include/asm/init.h | 2 ++ arch/x86/mm/init.c | 23 +++++++++++++++++++++++ arch/x86/mm/init_32.c | 19 ------------------- arch/x86/mm/init_64.c | 19 ------------------- 4 files changed, 25 insertions(+), 38 deletions(-)
arch/x86/include/asm/init.h +2 -0
@@ -5,6 +5,8 @@extern void __init early_ioremap_page_table_range_init (void );#endif +extern void __init zone_sizes_init (void ); + extern unsigned long __init kernel_physical_mapping_init(unsigned long start, unsigned long end,
arch/x86/mm/init.c +23 -0
@@ -3,6 +3,7 @@#include <linux/ioport.h> #include <linux/swap.h> #include <linux/memblock.h> +#include <linux/bootmem.h> /* for max_low_pfn */ #include <asm/cacheflush.h> #include <asm/e820.h>
@@ -15,6 +16,7 @@#include <asm/tlbflush.h> #include <asm/tlb.h> #include <asm/proto.h> +#include <asm/dma.h> /* for MAX_DMA_PFN */ unsigned long __initdata pgt_buf_start;unsigned long __meminitdata pgt_buf_end;
@@ -392,3 +394,24 @@ void free_initrd_mem(unsigned long start, unsigned long end) free_init_pages("initrd memory", start, PAGE_ALIGN(end)); }#endif + +void __init zone_sizes_init (void ) +{ +unsigned long max_zone_pfns[MAX_NR_ZONES ]; + +memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); + +#ifdef CONFIG_ZONE_DMA + max_zone_pfns[ZONE_DMA ] =MAX_DMA_PFN ; +#endif +#ifdef CONFIG_ZONE_DMA32 + max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ; +#endif + max_zone_pfns[ZONE_NORMAL ] = max_low_pfn; +#ifdef CONFIG_HIGHMEM + max_zone_pfns[ZONE_HIGHMEM ] = max_pfn; +#endif + +free_area_init_nodes (max_zone_pfns); +} +
arch/x86/mm/init_32.c +0 -19
@@ -674,25 +674,6 @@ void __init initmem_init(void) }#endif /* !CONFIG_NEED_MULTIPLE_NODES */ -static void __init zone_sizes_init (void ) -{ -unsigned long max_zone_pfns[MAX_NR_ZONES ]; - -memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); -#ifdef CONFIG_ZONE_DMA - max_zone_pfns[ZONE_DMA ] =MAX_DMA_PFN ; -#endif -#ifdef CONFIG_ZONE_DMA32 - max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ; -#endif - max_zone_pfns[ZONE_NORMAL ] = max_low_pfn; -#ifdef CONFIG_HIGHMEM - max_zone_pfns[ZONE_HIGHMEM ] = max_pfn; -#endif - -free_area_init_nodes (max_zone_pfns); -} -void __init setup_bootmem_allocator (void ) { printk(KERN_INFO " mapped low ram: 0 - %08lx\n",
arch/x86/mm/init_64.c +0 -19
@@ -612,25 +612,6 @@ void __init initmem_init(void) }#endif -static void __init zone_sizes_init (void ) -{ -unsigned long max_zone_pfns[MAX_NR_ZONES ]; - -memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); -#ifdef CONFIG_ZONE_DMA - max_zone_pfns[ZONE_DMA ] =MAX_DMA_PFN ; -#endif -#ifdef CONFIG_ZONE_DMA32 - max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ; -#endif - max_zone_pfns[ZONE_NORMAL ] = max_low_pfn; -#ifdef CONFIG_HIGHMEM - max_zone_pfns[ZONE_HIGHMEM ] = max_pfn; -#endif - -free_area_init_nodes (max_zone_pfns); -} -void __init paging_init (void ) {sparse_memory_present_with_active_regions (MAX_NUMNODES );
Signature · 1 line
1.7.6.4
Re: [RFC/PATCH 7/7] x86, mm: Unify zone_sizes_init()
Quoted 8 lines · Pekka Enberg
Now that
zone_sizes_init()is identical on 32-bit and 64-bit, move the code toarch/x86/mm/init.cand use it for both architectures.Cc Tejun Heo <[email protected]>Cc Yinghai Lu <[email protected]>Cc H. Peter Anvin <[email protected]>Cc David Rientjes <[email protected]>Signed-off-by Pekka Enberg <[email protected]>
For all seven patches in this series.
Thanks.
Signature · 1 line
tejun
Quoted 8 lines · Pekka Enberg
Use
MAX_DMA_PFNwhich represents the 16 MB ISA DMA limit on 32-bit x86 just like we do on 64-bit.Cc Tejun Heo <[email protected]>Cc Yinghai Lu <[email protected]>Cc H. Peter Anvin <[email protected]>Cc David Rientjes <[email protected]>Signed-off-by Pekka Enberg <[email protected]>
for this patch set:
Thanks
Yinghai
Quoted 8 lines · Pekka Enberg
Use
MAX_DMA_PFNwhich represents the 16 MB ISA DMA limit on 32-bit x86 just like we do on 64-bit.Cc Tejun Heo <[email protected]>Cc Yinghai Lu <[email protected]>Cc H. Peter Anvin <[email protected]>Cc David Rientjes <[email protected]>Signed-off-by Pekka Enberg <[email protected]>