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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 C1A1CC433DB for ; Thu, 7 Jan 2021 22:37:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6738A235FA for ; Thu, 7 Jan 2021 22:37:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6738A235FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C9D258D0157; Thu, 7 Jan 2021 17:37:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C4E468D0156; Thu, 7 Jan 2021 17:37:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8C478D0157; Thu, 7 Jan 2021 17:37:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0216.hostedemail.com [216.40.44.216]) by kanga.kvack.org (Postfix) with ESMTP id A25368D0156 for ; Thu, 7 Jan 2021 17:37:42 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6430C3632 for ; Thu, 7 Jan 2021 22:37:42 +0000 (UTC) X-FDA: 77680442364.20.burst12_3014b9d274ed Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 433D2180C07AB for ; Thu, 7 Jan 2021 22:37:42 +0000 (UTC) X-HE-Tag: burst12_3014b9d274ed X-Filterd-Recvd-Size: 4571 Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 Jan 2021 22:37:41 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 07 Jan 2021 14:37:40 -0800 Received: from [10.2.53.45] (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 7 Jan 2021 22:37:36 +0000 Subject: Re: [PATCH 2/2] mm: soft_dirty: userfaultfd: introduce wrprotect_tlb_flush_pending To: Linus Torvalds CC: Andrea Arcangeli , Linux-MM , Linux Kernel Mailing List , Yu Zhao , Andy Lutomirski , Peter Xu , Pavel Emelyanov , Mike Kravetz , Mike Rapoport , "Minchan Kim" , Will Deacon , Peter Zijlstra , Hugh Dickins , "Kirill A. Shutemov" , Matthew Wilcox , Oleg Nesterov , Jann Horn , Kees Cook , Leon Romanovsky , Jason Gunthorpe , Jan Kara , Kirill Tkhai References: <20210107200402.31095-1-aarcange@redhat.com> <20210107200402.31095-3-aarcange@redhat.com> <4100a6f5-ab0b-f7e5-962f-ea1dbcb1e47e@nvidia.com> <394e17bc-8bed-4d17-5dba-9ab8052c8bea@nvidia.com> From: John Hubbard Message-ID: Date: Thu, 7 Jan 2021 14:37:35 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1610059060; bh=WLexG3mwccsWz032chhqLUoQKIYVeN3uLdxDYE6jTFk=; h=Subject:To:CC:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=fiHQFzpgncVHW6vVq4qgLhx+bpYi7akpoT6QJg38qyOWLHsNQHHtgB2xMRmV3lG4T HSRD5E4gCsAj2WM4U5Wyga/2pUVHgvaCoE2NnLK8Sj+KC3GFBVYLeL3GM+Q7qs5ldU O5HzvIfzHMic+U+De1aahxyV3KPhFV9Db08bVwpIy0ZwQEgAHGkHT2dKckoZ6A6LXJ i2QHkqKT5Mtu84MIbu14obXWlxUq3DSjsoBgTbsHniYDbH2uQlZq4jNRhCltYBKyG7 s4dM19fkt1uTEnHdiISTSWHkVUPfdaQimioIi/Q2yMdaQdY9LrOD28PJwwQSpgGCJe i/Eqsm+evbfHA== 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 1/7/21 2:24 PM, Linus Torvalds wrote: > On Thu, Jan 7, 2021 at 2:20 PM Linus Torvalds > wrote: >> >> Hmm, add a check for the page being PageAnon(), perhaps? >> >> If it's a shared vma, then the page can be pinned shared with multiple >> mappings, I agree. > > Or check the vma directly for whether it's a COW vma. That's probably > a more obvious test, but would have to be done outside of > page_maybe_dma_pinned(). > > For example, in copy_present_page(), we've already done that COW-vma > test, so if we want to strengthen just _that_ test, then it would be > sufficient to just add a > > /* This cannot be a pinned page if it has more than one mapping */ > if (page_mappings(page) != 1) > return 1; > > to copy_present_page() along with the existing page_maybe_dma_pinned() test. > > No? > > Linus That approach makes me a lot happier, yes. Because it doesn't add constraints to the RDMA cases, but still does what we need here. thanks, -- John Hubbard NVIDIA