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=-7.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 5D511C35280 for ; Wed, 2 Oct 2019 09:21:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0072221783 for ; Wed, 2 Oct 2019 09:21:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=shipmail.org header.i=@shipmail.org header.b="lG5wyc8l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0072221783 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shipmail.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8C3A36B0005; Wed, 2 Oct 2019 05:21:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 873EC6B0006; Wed, 2 Oct 2019 05:21:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 789186B0007; Wed, 2 Oct 2019 05:21:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0057.hostedemail.com [216.40.44.57]) by kanga.kvack.org (Postfix) with ESMTP id 5847B6B0005 for ; Wed, 2 Oct 2019 05:21:14 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id E6274A2B3 for ; Wed, 2 Oct 2019 09:21:13 +0000 (UTC) X-FDA: 75998300826.20.tank60_a93bec3c5a38 X-HE-Tag: tank60_a93bec3c5a38 X-Filterd-Recvd-Size: 5226 Received: from ste-pvt-msa1.bahnhof.se (ste-pvt-msa1.bahnhof.se [213.80.101.70]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Wed, 2 Oct 2019 09:21:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTP id CE6BC3F6BA; Wed, 2 Oct 2019 11:21:10 +0200 (CEST) Authentication-Results: ste-pvt-msa1.bahnhof.se; dkim=pass (1024-bit key; unprotected) header.d=shipmail.org header.i=@shipmail.org header.b=lG5wyc8l; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at bahnhof.se Received: from ste-pvt-msa1.bahnhof.se ([127.0.0.1]) by localhost (ste-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IS1Y-KJ7u8fr; Wed, 2 Oct 2019 11:21:08 +0200 (CEST) Received: from mail1.shipmail.org (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) (Authenticated sender: mb878879) by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id BD2D53F6AE; Wed, 2 Oct 2019 11:21:02 +0200 (CEST) Received: from localhost.localdomain (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) by mail1.shipmail.org (Postfix) with ESMTPSA id 3ED77360058; Wed, 2 Oct 2019 11:21:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1570008062; bh=Rg6OP4o/QDF7kwct9j3Hp3SgvBNu7Bw7IgByIFeVLSM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=lG5wyc8lQDIxcnSs7OriVvn1LeHWxFlMWPeukWdSGkuyjj7G3P4OCiWue0gORAIUf LZx/cvGYLNTw2DPdP/ZnO6ZB2sUiXQxbFZArSNSGR7GR31+0pqmpK6HXOx5tasvq4J ZmqJkQcWgNu4G84gb9KrSb21Ls+TXeQiSMgYaBIA= Subject: Re: Ack to merge through DRM? WAS Re: [PATCH v2 1/5] mm: Add write-protect and clean utilities for address space ranges To: Linus Torvalds , "Kirill A. Shutemov" Cc: Linux Kernel Mailing List , dri-devel , Linux-MM , Andrew Morton , Matthew Wilcox References: <20190926115548.44000-1-thomas_os@shipmail.org> <20190926115548.44000-2-thomas_os@shipmail.org> <85e31bcf-d3c8-2fcf-e659-2c9f82ebedc7@shipmail.org> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28VMware=29?= Organization: VMware Inc. Message-ID: <50e83aeb-e971-f0ad-f034-ed592588eba7@shipmail.org> Date: Wed, 2 Oct 2019 11:21:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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 9/26/19 10:16 PM, Linus Torvalds wrote: > On Thu, Sep 26, 2019 at 1:09 PM Thomas Hellstr=C3=B6m (VMware) > wrote: >> That said, if people are OK with me modifying the assert in >> pud_trans_huge_lock() and make __walk_page_range non-static, it should >> probably be possible to make it work, yes. > I don't think you need to modify that assert at all. > > That thing only exists when there's a "pud_entry" op in the walker, > and then you absolutely need to have that mmap_lock. > > As far as I can tell, you fundamentally only ever work on a pte level > in your address space walker already and actually have a WARN_ON() on > the pud_huge thing, so no pud entry can possibly apply. > > So no, the assert in pud_trans_huge_lock() does not seem to be a > reason not to just use the existing page table walkers. > > And once you get rid of the walking, what is left? Just the "iterate > over the inode mappings" part. Which could just be done in > mm/pagewalk.c, and then you don't even need to remove the static. > > So making it be just another walking in pagewalk.c would seem to be > the simplest model. > > Call it "walk_page_mapping()". And talk extensively about how the > locking differs a lot from the usual "walk_page_vma()" things. > > The then actual "apply" functions (what a horrid name) could be in the > users. They shouldn't be mixed in with the walking functions anyway. > They are callbacks, not walkers. > > Linus Linus, Kirill I've pushed a reworked version based on the pagewalk code here: https://cgit.freedesktop.org/~thomash/linux/log/?h=3Dpagewalk (top three patched) with users included here: https://cgit.freedesktop.org/~thomash/linux/log/?h=3Dcoherent-rebased Do you think this could work? The reason that the "mm: Add write-protect=20 and clean.." code is still in mm as a set of helpers, is of course that=20 much of the needed functionality is not exported, presumably since we=20 want to keep page table manipulation in mm. Thanks, Thomas