From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750876AbdEAWIE (ORCPT ); Mon, 1 May 2017 18:08:04 -0400 Received: from mail-ua0-f195.google.com ([209.85.217.195]:35227 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715AbdEAWIB (ORCPT ); Mon, 1 May 2017 18:08:01 -0400 MIME-Version: 1.0 In-Reply-To: <20170501193214.fbozpx6dlrapsma3@gmail.com> References: <1493654135-16645-1-git-send-email-bhe@redhat.com> <20170501193214.fbozpx6dlrapsma3@gmail.com> From: Yinghai Lu Date: Mon, 1 May 2017 15:08:00 -0700 X-Google-Sender-Auth: ITF2nzhOqvwrlIMNuT_cgjrTurw Message-ID: Subject: Re: [PATCH v2] x86/mm: Fix incorrect for loop count calculation in sync_global_pgds To: Ingo Molnar Cc: Baoquan He , Linux Kernel Mailing List , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "the arch/x86 maintainers" , Kees Cook , Thomas Garnier , Andrew Morton , Yasuaki Ishimatsu , Jinbum Park , Dave Hansen , "Kirill A. Shutemov" , Dan Williams , Dave Young Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 1, 2017 at 12:32 PM, Ingo Molnar wrote: > > * Baoquan He wrote: > >> arch/x86/mm/init_64.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c >> index 15173d3..dfa9edb 100644 >> --- a/arch/x86/mm/init_64.c >> +++ b/arch/x86/mm/init_64.c >> @@ -96,7 +96,9 @@ void sync_global_pgds(unsigned long start, unsigned long end) >> { >> unsigned long address; >> >> - for (address = start; address <= end; address += PGDIR_SIZE) { >> + for (address = start; address <= end; >> + address = ALIGN(address + 1, PGDIR_SIZE)) { >> + >> const pgd_t *pgd_ref = pgd_offset_k(address); >> struct page *page; > > This patch does not apply cleanly to tip:master. > > You can avoid the col80 problems by renaming 'address' to the canonical 'addr' > name, the loop will become: > > for (addr = start; addr <= end; addr = ALIGN(addr + 1, PGDIR_SIZE)) { > > ... which fits into 80 cols. would be more readable to make sync_global_pgds() loop is more like that in kernel_physical_mapping_init() ? vaddr_start = vaddr; for (; vaddr < vaddr_end; vaddr = vaddr_next) { ... vaddr_next = (vaddr & PGDIR_MASK) + PGDIR_SIZE; Yinghai