Skip to contentSkip to conversation

x86: use roundup() instead of PAGE_ALIGN() in find_early_table_space()

PATCH In review Pekka Enberg 1 participant 2 messages Mar 3, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 x86: use roundup() instead of PAGE_ALIGN() in find_early_table_space()

From: Pekka Enberg <[email protected]>

Impact: cleanup

This patch changes find_early_table_space() to use roundup() for rounding up tables to page size to unify the common parts of the 32-bit and 64-bit implementations.

---
 arch/x86/mm/init_32.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/mm/init_32.c +4 -4
index 1a2e193..a0c32d5 100644
@@ -824,10 +824,10 @@ static void __init find_early_table_space(unsigned long end, int use_pse)
 	unsigned long puds, pmds, ptes, tables, start;
 
 	puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
-	tables = PAGE_ALIGN(puds * sizeof(pud_t));
+	tables = roundup(puds * sizeof(pud_t), PAGE_SIZE);
 
 	pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
-	tables += PAGE_ALIGN(pmds * sizeof(pmd_t));
+	tables += roundup(pmds * sizeof(pmd_t), PAGE_SIZE);
 
 	if (use_pse) {
 		unsigned long extra;
@@ -838,10 +838,10 @@ static void __init find_early_table_space(unsigned long end, int use_pse)
 	} else
 		ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
 
-	tables += PAGE_ALIGN(ptes * sizeof(pte_t));
+	tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE);
 
 	/* for fixmap */
-	tables += PAGE_ALIGN(__end_of_fixed_addresses * sizeof(pte_t));
+	tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE);
 
 	/*
 	 * RED-PEN putting page tables only on node 0 could
Signature · 1 line
1.5.4.3
#1 lore raw
Commit-ID:  fd578f9c0a0a7bf3e460e6f21cdc6f4018949e80
Gitweb:     http://git.kernel.org/tip/fd578f9c0a0a7bf3e460e6f21cdc6f4018949e80
Author:     "Pekka Enberg" <[email protected]>
AuthorDate: Tue, 3 Mar 2009 12:55:05 +0200
Commit:     Ingo Molnar <[email protected]>
CommitDate: Tue, 3 Mar 2009 12:07:00 +0100

x86: use roundup() instead of PAGE_ALIGN() in find_early_table_space()

Impact: cleanup

This patch changes find_early_table_space() to use roundup() for rounding up tables to page size to unify the common parts of the 32-bit and 64-bit implementations.

LKML-Reference: <1236077705.2675.6.camel@penberg-laptop>

---
 arch/x86/mm/init_32.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/mm/init_32.c +4 -4
index 5b06a2f..1dd6b63 100644
@@ -845,10 +845,10 @@ static void __init find_early_table_space(unsigned long end, int use_pse)
 	unsigned long puds, pmds, ptes, tables, start;
 
 	puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
-	tables = PAGE_ALIGN(puds * sizeof(pud_t));
+	tables = roundup(puds * sizeof(pud_t), PAGE_SIZE);
 
 	pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
-	tables += PAGE_ALIGN(pmds * sizeof(pmd_t));
+	tables += roundup(pmds * sizeof(pmd_t), PAGE_SIZE);
 
 	if (use_pse) {
 		unsigned long extra;
@@ -859,10 +859,10 @@ static void __init find_early_table_space(unsigned long end, int use_pse)
 	} else
 		ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
 
-	tables += PAGE_ALIGN(ptes * sizeof(pte_t));
+	tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE);
 
 	/* for fixmap */
-	tables += PAGE_ALIGN(__end_of_fixed_addresses * sizeof(pte_t));
+	tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE);
 
 	/*
 	 * RED-PEN putting page tables only on node 0 could