From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFddX-0002SU-OQ for linux-um@lists.infradead.org; Tue, 08 Sep 2020 13:26:16 +0000 Received: by mail-qk1-x741.google.com with SMTP id f2so15235961qkh.3 for ; Tue, 08 Sep 2020 06:26:13 -0700 (PDT) Date: Tue, 8 Sep 2020 10:26:10 -0300 From: Jason Gunthorpe Subject: Re: [RFC PATCH v2 2/3] mm: make pXd_addr_end() functions page-table entry aware Message-ID: <20200908132610.GB87483@ziepe.ca> References: <20200907180058.64880-1-gerald.schaefer@linux.ibm.com> <20200907180058.64880-3-gerald.schaefer@linux.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200907180058.64880-3-gerald.schaefer@linux.ibm.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: Gerald Schaefer Cc: Peter Zijlstra , Benjamin Herrenschmidt , Dave Hansen , linux-mm , Paul Mackerras , linux-sparc , Alexander Gordeev , Claudio Imbrenda , Will Deacon , linux-arch , linux-s390 , Vasily Gorbik , Richard Weinberger , linux-x86 , Russell King , Christian Borntraeger , Ingo Molnar , Catalin Marinas , Andrey Ryabinin , Heiko Carstens , Arnd Bergmann , John Hubbard , Jeff Dike , linux-um , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , linux-arm , linux-power , LKML , Michael Ellerman , Andrew Morton , Linus Torvalds , Mike Rapoport On Mon, Sep 07, 2020 at 08:00:57PM +0200, Gerald Schaefer wrote: > From: Alexander Gordeev > > Unlike all other page-table abstractions pXd_addr_end() do not take > into account a particular table entry in which context the functions > are called. On architectures with dynamic page-tables folding that > might lead to lack of necessary information that is difficult to > obtain other than from the table entry itself. That already led to > a subtle memory corruption issue on s390. > > By letting pXd_addr_end() functions know about the page-table entry > we allow archs not only make extra checks, but also optimizations. > > As result of this change the pXd_addr_end_folded() functions used > in gup_fast traversal code become unnecessary and get replaced with > universal pXd_addr_end() variants. > > The arch-specific updates not only add dereferencing of page-table > entry pointers, but also small changes to the code flow to make those > dereferences possible, at least for x86 and powerpc. Also for arm64, > but in way that should not have any impact. > > So, even though the dereferenced page-table entries are not used on > archs other than s390, and are optimized out by the compiler, there > is a small change in kernel size and this is what bloat-o-meter reports: This looks pretty clean and straightfoward, only __munlock_pagevec_fill() had any real increased complexity. Thanks, Jason _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um