From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CACB2C2BBD0 for ; Tue, 8 Sep 2020 13:26:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4FCCC23C16 for ; Tue, 8 Sep 2020 13:26:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="Lf6G5poV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FCCC23C16 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D2F1F6B005C; Tue, 8 Sep 2020 09:26:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB97B6B005D; Tue, 8 Sep 2020 09:26:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B80FB6B0062; Tue, 8 Sep 2020 09:26:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0173.hostedemail.com [216.40.44.173]) by kanga.kvack.org (Postfix) with ESMTP id 9B0B56B005C for ; Tue, 8 Sep 2020 09:26:13 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6509A1F08 for ; Tue, 8 Sep 2020 13:26:13 +0000 (UTC) X-FDA: 77239967826.09.smile56_51050a4270d5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 40972180AD81A for ; Tue, 8 Sep 2020 13:26:13 +0000 (UTC) X-HE-Tag: smile56_51050a4270d5 X-Filterd-Recvd-Size: 5932 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Sep 2020 13:26:12 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id n133so15148447qkn.11 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=Y11wSmRp+h07TLcoa1zsXA7y/ARrJmhmjzKneF0QPcdYMikphVkTCxMCjSiVU1KsOS zh/7iuo6rpge8U5pmU+2Z9GIoBIvvrTww2gGQeHyuydQ6nW5OpK7owAAY9+QDPVb3HW4 aczZgT2EKZMkuvQr+2Euqxn8lJKMtP78KurQJju/U6/eEby4AM6Mh/fhRv5Fyks/mgvt trSFrfUCxdlpdmUw/IW9YHd0R0BRocBoGCfqPHOzr61Pwdxzw94mU2qKgt0cKd8DOCFf Qgm5/oIvqNdREMMCHv/zrpDTKfWpGytQXVzzOTZ5N64dTRm99/vhbVQ01FA8vYV1AWkx W2Ug== X-Gm-Message-State: AOAM532GtfhPHJbZjdoT6XDRgd8AXhlMmOJiJsGXcyRKzzxWR/oP3UaV s5pKPztmSJy0IEjhGuI95gDwvw== X-Google-Smtp-Source: ABdhPJytassnqIHgDUzIEWSN+bwEo6szoZotvnjMoppJpA+RAkN2BANjzTq153kTDs5DZf5N4KZr1w== 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> X-Rspamd-Queue-Id: 40972180AD81A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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