Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4177116pxk; Tue, 8 Sep 2020 12:41:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTu69r2mFORg26W1HlWLSj5gcAQGehKb8vVFNNs+JOR3uqeJ3Gh3RFgme/h/w7V1iMDswj X-Received: by 2002:a17:906:8289:: with SMTP id h9mr26008ejx.45.1599594083699; Tue, 08 Sep 2020 12:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599594083; cv=none; d=google.com; s=arc-20160816; b=EfD099WIIiLErmFz1xNG+vrKG8n8pDpxLx65LsHAVuwpRuaANHi1eJ0VEZt2OuJj4+ UVFnpcIP6BD/bB29lv3xdJoUFtEb9EvN0xNMBVCRGm5uyVoreyV5fTrcjh4k/JWbSjZT Jw+tFk55ojkpjD9UFKBMbRZaQEagdphRfdyV3+p/fUCl23WkmMjXAnlSQS/nqEsVdt0V PJvgIWbBccYtmHg1UPPIoyDWbKt2gkVOf7E4dJjUVB7dtvEeTBxsZwBly9LWO1JQtyG8 hCK+ChWcHJFWc7LKc0XwFvncrTg7jzHL6oPGdntrOuV6kX7H6wgeuaj7F8n7Tf4D3DlK aScA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=0Bd9eUG3DnE6D+neFj9R3QfT/oWxBp+wzdY7i+GsBSw=; b=sDeomOjAnkCBfy1tjU6mH9aLLiT3YQQpuJ/FxPYEXw/YCZl91li6QeDLZub9QpE0rK A25jBCJFoptszo+8pMjhmYu7F2s3ICuAdfRUXtwsTfGFA9nTk50UNudI4njpczYsX8Mq PFm2a31RwNhiD97CxKs4S33eouh9TcHF9wTQHi8rmFUb7ouTUWxVpEIlHqlS61JUUoo4 JTKTpByFLNMglcKLZBXvwtNyI17i3i7FuIJe8+eqsLDbnymzUZ8mY3LzIFh4wmwpk8Qa Lo2LJeJDJ9ezkq57srWN0LMnoc7Gd/SUEjdD8MBCehFgo0lqaZzC9Md54T1qhZ4IOTP3 CAdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=Lf6G5poV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r5si21186edx.458.2020.09.08.12.41.01; Tue, 08 Sep 2020 12:41:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=Lf6G5poV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730205AbgIHTjK (ORCPT + 99 others); Tue, 8 Sep 2020 15:39:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730187AbgIHPzg (ORCPT ); Tue, 8 Sep 2020 11:55:36 -0400 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A499C061231 for ; Tue, 8 Sep 2020 06:26:12 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id q5so13009895qkc.2 for ; Tue, 08 Sep 2020 06:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0Bd9eUG3DnE6D+neFj9R3QfT/oWxBp+wzdY7i+GsBSw=; b=Lf6G5poVVU9DTO5y/Kk8H2Ke1/yuvwq44QRfLlgtzVksH3W4CflZYO6N1CS6Gkgf+O 36N3+8wD9pObYI1CMdwZYMYRu7HbXVUKEFPJ2AjNcK9X3BID5PsppQaFjSnqxa7JtCNT aY2EX4mu669m3AJgX7WT/I/zIn+qpP2LPn3ueNiUgo8NZRJ/0OvY6GqXffz02hp9ASt6 Kw7kagCQ12/ztkbDpZvauMGFhf/ti5rup7TXyfyR2MZlnoY6C7+c78nhZr2bXok7Z+TB z94051jMYxpI6fAzrkfx1CYHrWeWBF5AFFZLbShjEyTsCM8ydvp1pulj0ri7yDSPS5ma HXGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0Bd9eUG3DnE6D+neFj9R3QfT/oWxBp+wzdY7i+GsBSw=; b=jPAgKV9ruffeTfdAxG6OebWSrmV6IDhP0X2UIfrDPuHAiaQw/p3EragU/C7hDoHC0Q hHli3pEdcGmiFFeYuqlqhSDNzKWvnx1AfMHm9YO23ig7+RSdEhmROUeQW1iRHWtClli2 cAWEKbwtogtLs6FKUv3So583dWmZ1bzmSGRjKYTlMEx1zV5CmUSAxbXXFzaZTDR8bVt5 OKEdp2wQowvxxIRToZvQ3HyJZVTZBAgjHUQ4iC8R6u3JZYDxL/9CUt4Sk2SdAftQf78d B6AjZbT52fRilaWgazhTAjqeMdzrf2DbtCgAjYAKuAQXZyCElFxaznonG4L/eiZIH4Nl apjw== X-Gm-Message-State: AOAM531b4fMZU2si5Su5Fd8WOBsVZ8l++rlf9IjDNTqLW6obnZQMDLxU +WW5OwfmnaKJMbBISNVn6irxeg== X-Received: by 2002:a05:620a:6d9:: with SMTP id 25mr18567qky.269.1599571572011; Tue, 08 Sep 2020 06:26:12 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id j8sm14658360qth.90.2020.09.08.06.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 06:26:11 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kFddS-002zaX-9j; Tue, 08 Sep 2020 10:26:10 -0300 Date: Tue, 8 Sep 2020 10:26:10 -0300 From: Jason Gunthorpe To: Gerald Schaefer Cc: John Hubbard , LKML , linux-mm , linux-arch , Andrew Morton , Linus Torvalds , Russell King , Mike Rapoport , Catalin Marinas , Will Deacon , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Jeff Dike , Richard Weinberger , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Arnd Bergmann , Andrey Ryabinin , linux-x86 , linux-arm , linux-power , linux-sparc , linux-um , linux-s390 , Alexander Gordeev , Vasily Gorbik , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200907180058.64880-3-gerald.schaefer@linux.ibm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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