x86: pre-initialize boot_cpu_data.x86_phys_bits to avoid system_state tests

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, March 30, 2009 - 12:37 pm

Gitweb:     http://git.kernel.org/linus/ed26dbe5ae045e5bf95c6dc27497397a3fde52e1
Commit:     ed26dbe5ae045e5bf95c6dc27497397a3fde52e1
Parent:     dc16ecf7fd1fad7436832121435d4926a81d469e
Author:     Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
AuthorDate: Wed Mar 4 16:16:51 2009 -0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu Mar 5 14:53:43 2009 +0100

    x86: pre-initialize boot_cpu_data.x86_phys_bits to avoid system_state tests
    
    Impact: cleanup, micro-optimization
    
    Pre-initialize boot_cpu_data.x86_phys_bits to a reasonable default
    to remove the use of system_state tests in __virt_addr_valid()
    and __phys_addr().
    
    Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/setup.c |    4 +++-
 arch/x86/mm/ioremap.c   |    7 ++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index b746deb..f28c56e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -202,7 +202,9 @@ struct ist_info ist_info;
 #endif
 
 #else
-struct cpuinfo_x86 boot_cpu_data __read_mostly;
+struct cpuinfo_x86 boot_cpu_data __read_mostly = {
+	.x86_phys_bits = MAX_PHYSMEM_BITS,
+};
 EXPORT_SYMBOL(boot_cpu_data);
 #endif
 
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index a23ca5b..62773ab 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -38,8 +38,7 @@ unsigned long __phys_addr(unsigned long x)
 	} else {
 		VIRTUAL_BUG_ON(x < PAGE_OFFSET);
 		x -= PAGE_OFFSET;
-		VIRTUAL_BUG_ON(system_state == SYSTEM_BOOTING ? x > MAXMEM :
-					!phys_addr_valid(x));
+		VIRTUAL_BUG_ON(!phys_addr_valid(x));
 	}
 	return x;
 }
@@ -56,10 +55,8 @@ bool __virt_addr_valid(unsigned long x)
 		if (x < PAGE_OFFSET)
 			return false;
 		x -= PAGE_OFFSET;
-		if (system_state == SYSTEM_BOOTING ?
-				x > MAXMEM : !phys_addr_valid(x)) {
+		if (!phys_addr_valid(x))
 			return false;
-		}
 	}
 
 	return pfn_valid(x >> PAGE_SHIFT);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
x86: pre-initialize boot_cpu_data.x86_phys_bits to avoid s ..., Linux Kernel Mailing ..., (Mon Mar 30, 12:37 pm)