From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f72.google.com (mail-wm0-f72.google.com [74.125.82.72]) by kanga.kvack.org (Postfix) with ESMTP id 866AC6B0279 for ; Fri, 2 Jun 2017 11:04:55 -0400 (EDT) Received: by mail-wm0-f72.google.com with SMTP id g15so17409773wmc.8 for ; Fri, 02 Jun 2017 08:04:55 -0700 (PDT) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com. [2a00:1450:400c:c09::243]) by mx.google.com with ESMTPS id r188si3095182wmf.131.2017.06.02.08.04.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 08:04:54 -0700 (PDT) Received: by mail-wm0-x243.google.com with SMTP id k15so19470201wmh.3 for ; Fri, 02 Jun 2017 08:04:53 -0700 (PDT) Date: Fri, 2 Jun 2017 18:04:51 +0300 From: "Kirill A. Shutemov" Subject: Re: [PATCHv6 06/10] x86/mm: Add sync_global_pgds() for configuration with 5-level paging Message-ID: <20170602150451.nspo54dzp7y54wdk@node.shutemov.name> References: <20170524095419.14281-1-kirill.shutemov@linux.intel.com> <20170524095419.14281-7-kirill.shutemov@linux.intel.com> <86bddb33-4f07-2949-256b-caf931df98d8@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86bddb33-4f07-2949-256b-caf931df98d8@virtuozzo.com> Sender: owner-linux-mm@kvack.org List-ID: To: Andrey Ryabinin Cc: "Kirill A. Shutemov" , x86@kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andi Kleen , Dave Hansen , Andy Lutomirski , Dan Williams , linux-mm@kvack.org, linux-kernel@vger.kernel.org On Fri, Jun 02, 2017 at 05:50:34PM +0300, Andrey Ryabinin wrote: > On 05/24/2017 12:54 PM, Kirill A. Shutemov wrote: > > This basically restores slightly modified version of original > > sync_global_pgds() which we had before folded p4d was introduced. > > > > The only modification is protection against 'addr' overflow. > > > > Signed-off-by: Kirill A. Shutemov > > --- > > arch/x86/mm/init_64.c | 39 +++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 39 insertions(+) > > > > diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c > > index 95651dc58e09..ce410c05d68d 100644 > > --- a/arch/x86/mm/init_64.c > > +++ b/arch/x86/mm/init_64.c > > @@ -92,6 +92,44 @@ __setup("noexec32=", nonx32_setup); > > * When memory was added make sure all the processes MM have > > * suitable PGD entries in the local PGD level page. > > */ > > +#ifdef CONFIG_X86_5LEVEL > > +void sync_global_pgds(unsigned long start, unsigned long end) > > +{ > > + unsigned long addr; > > + > > + for (addr = start; addr <= end; addr += ALIGN(addr + 1, PGDIR_SIZE)) { > > addr = ALIGN(addr + 1, PGDIR_SIZE) Ouch. Thanks for noticing this. Strange that it haven't crashed anywhere in my tests. -- Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org