x86/mm: Make highstart_pfn and highend_pfn local to initmem_init()
PATCH 1/2 x86/mm: Make highstart_pfn and highend_pfn local to initmem_init()
Since commit 35c3151a98a6 ("x86/mm: Consolidate initmem_init()") removed arch/x86/mm/numa_32.c, highstart_pfn and highend_pfn are only used in initmem_init().
Declare both variables locally and remove their unused extern declaration. Use min() to initialize highstart_pfn.
No functional change.
--- arch/x86/include/asm/highmem.h | 3 --- arch/x86/mm/init_32.c | 8 +++----- 2 files changed, 3 insertions(+), 8 deletions(-)
arch/x86/include/asm/highmem.h +0 -3
@@ -27,9 +27,6 @@#include <asm/fixmap.h> #include <asm/pgtable_areas.h> -/* declarations for highmem.c */ -extern unsigned long highstart_pfn, highend_pfn; -/* * Right now we initialize only a single pte table. It can be extended * easily, subsequent pte tables have to be allocated in one physical
arch/x86/mm/init_32.c +3 -5
@@ -55,8 +55,6 @@#include "mm_internal.h" -unsigned long highstart_pfn, highend_pfn; -bool __read_mostly __vmalloc_start_set = false;/*
@@ -615,9 +613,9 @@ void __init find_low_pfn_range(void)void __init initmem_init (void ) {#ifdef CONFIG_HIGHMEM - highstart_pfn = highend_pfn = max_pfn; -if (max_pfn > max_low_pfn) - highstart_pfn = max_low_pfn; +unsigned long highstart_pfn =min (max_pfn, max_low_pfn); +unsigned long highend_pfn = max_pfn; +printk (KERN_NOTICE "%ldMB HIGHMEM available.\n" ,pages_to_mb (highend_pfn - highstart_pfn)); high_memory = (void *)__va (highstart_pfn *PAGE_SIZE -1 ) +1 ;
PATCH 2/2 x86/mm: Convert printk(KERN_*) to pr_*() in initmem_init()
Convert printk(KERN_*) to pr_notice() and pr_info(), use %lu for the unsigned long arguments, and add spaces around the shift operators.
No functional change.
--- arch/x86/mm/init_32.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
arch/x86/mm/init_32.c +4 -7
@@ -616,8 +616,7 @@ void __init initmem_init(void)unsigned long highstart_pfn =min (max_pfn, max_low_pfn);unsigned long highend_pfn = max_pfn; -printk (KERN_NOTICE "%ldMB HIGHMEM available.\n" , -pages_to_mb (highend_pfn - highstart_pfn)); +pr_notice ("%luMB HIGHMEM available.\n" ,pages_to_mb (highend_pfn - highstart_pfn)); high_memory = (void *)__va (highstart_pfn *PAGE_SIZE -1 ) +1 ;#else high_memory = (void *)__va (max_low_pfn *PAGE_SIZE -1 ) +1 ;
@@ -627,12 +626,10 @@ void __init initmem_init(void) __vmalloc_start_set = true; -printk (KERN_NOTICE "%ldMB LOWMEM available.\n" , -pages_to_mb (max_low_pfn)); +pr_notice ("%luMB LOWMEM available.\n" ,pages_to_mb (max_low_pfn)); -printk (KERN_INFO " mapped low ram: 0 - %08lx\n" , - max_pfn_mapped<<PAGE_SHIFT ); -printk (KERN_INFO " low ram: 0 - %08lx\n" , max_low_pfn<<PAGE_SHIFT ); +pr_info (" mapped low ram: 0 - %08lx\n" , max_pfn_mapped <<PAGE_SHIFT ); +pr_info (" low ram: 0 - %08lx\n" , max_low_pfn <<PAGE_SHIFT ); }/*
Re: [PATCH 2/2] x86/mm: Convert printk(KERN_*) to pr_*() in initmem_init()
Quoted 2 lines · Thorsten Blum
Convert
printk(KERN_*)topr_notice()andpr_info(), use %lu for the unsigned long arguments, and add spaces around the shift operators.
Heh, there are about 90 printk(KERN_*) in arch/x86/mm and way more in arch/x86.
Maybe change them in a scripted sweep?
Quoted 37 lines
No functional change.
Signed-off-by Thorsten Blum <[email protected]>--- arch/x86/mm/init_32.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)arch/x86/mm/init_32.c +4
-7@@ -616,8 +616,7 @@ void __init initmem_init(void)unsigned long highstart_pfn =min (max_pfn, max_low_pfn);unsigned long highend_pfn = max_pfn; -printk (KERN_NOTICE "%ldMB HIGHMEM available.\n" , -pages_to_mb (highend_pfn - highstart_pfn)); +pr_notice ("%luMB HIGHMEM available.\n" ,pages_to_mb (highend_pfn - highstart_pfn)); high_memory = (void *)__va (highstart_pfn *PAGE_SIZE -1 ) +1 ;#else high_memory = (void *)__va (max_low_pfn *PAGE_SIZE -1 ) +1 ;@@ -627,12 +626,10 @@ void __init initmem_init(void) __vmalloc_start_set = true; -printk (KERN_NOTICE "%ldMB LOWMEM available.\n" , -pages_to_mb (max_low_pfn)); +pr_notice ("%luMB LOWMEM available.\n" ,pages_to_mb (max_low_pfn)); -printk (KERN_INFO " mapped low ram: 0 - %08lx\n" , - max_pfn_mapped<<PAGE_SHIFT ); -printk (KERN_INFO " low ram: 0 - %08lx\n" , max_low_pfn<<PAGE_SHIFT ); +pr_info (" mapped low ram: 0 - %08lx\n" , max_pfn_mapped <<PAGE_SHIFT ); +pr_info (" low ram: 0 - %08lx\n" , max_low_pfn <<PAGE_SHIFT ); }/*
Signature · 2 lines
Sincerely yours, Mike.
Re: [PATCH 2/2] x86/mm: Convert printk(KERN_*) to pr_*() in initmem_init()
Quoted 8 lines · Mike Rapoport
Quoted 2 lines · Thorsten Blum
Convert
printk(KERN_*)topr_notice()andpr_info(), use %lu for the unsigned long arguments, and add spaces around the shift operators.Heh, there are about 90
printk(KERN_*)inarch/x86/mmand way more inarch/x86.Maybe change them in a scripted sweep?
I prefer to convert them when I'm already touching the code rather than in a broader sweep. The %ld to %lu and the spacing changes modify these lines anyway, which would trigger multiple checkpatch warnings about the leftover printk(KERN_*) calls.
Quoted 10 lines · Thorsten Blum
Since commit
35c3151a98a6("x86/mm: Consolidateinitmem_init()") removedarch/x86/mm/numa_32.c,highstart_pfnandhighend_pfnare only used ininitmem_init().Declare both variables locally and remove their unused extern declaration. Use
min()to initializehighstart_pfn.No functional change.
Signed-off-by Thorsten Blum <[email protected]>
Quoted 4 lines
--- arch/x86/include/asm/highmem.h | 3 --- arch/x86/mm/init_32.c | 8 +++----- 2 files changed, 3 insertions(+), 8 deletions(-)
Signature · 2 lines
Sincerely yours, Mike.