From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756570Ab3AXU2e (ORCPT ); Thu, 24 Jan 2013 15:28:34 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:26133 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030206Ab3AXUVJ (ORCPT ); Thu, 24 Jan 2013 15:21:09 -0500 From: Yinghai Lu To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Cc: "Eric W. Biederman" , Andrew Morton , Jan Kiszka , Jason Wessel , Borislav Petkov , linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH 05/35] x86, 64bit, mm: Make pgd next calculation consistent with pud/pmd Date: Thu, 24 Jan 2013 12:19:46 -0800 Message-Id: <1359058816-7615-6-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359058816-7615-1-git-send-email-yinghai@kernel.org> References: <1359058816-7615-1-git-send-email-yinghai@kernel.org> X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just like the way we calculate next for pud and pmd, aka round down and add size. Also, do not do boundary-checking with 'next', and just pass 'end' down to phys_pud_init() instead. Because the loop in phys_pud_init() stops at PTRS_PER_PUD and thus can handle a possibly bigger 'end' properly. Signed-off-by: Yinghai Lu --- arch/x86/mm/init_64.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 167439c..b1178eb 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -530,9 +530,7 @@ kernel_physical_mapping_init(unsigned long start, pgd_t *pgd = pgd_offset_k(start); pud_t *pud; - next = (start + PGDIR_SIZE) & PGDIR_MASK; - if (next > end) - next = end; + next = (start & PGDIR_MASK) + PGDIR_SIZE; if (pgd_val(*pgd)) { pud = (pud_t *)pgd_page_vaddr(*pgd); @@ -542,7 +540,7 @@ kernel_physical_mapping_init(unsigned long start, } pud = alloc_low_page(); - last_map_addr = phys_pud_init(pud, __pa(start), __pa(next), + last_map_addr = phys_pud_init(pud, __pa(start), __pa(end), page_size_mask); spin_lock(&init_mm.page_table_lock); -- 1.7.10.4