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=-5.8 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,URIBL_BLOCKED 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 DC474C433DB for ; Thu, 7 Jan 2021 22:32:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 745EC23600 for ; Thu, 7 Jan 2021 22:32:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 745EC23600 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CFEFB8D0150; Thu, 7 Jan 2021 17:32:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CD3C36B0176; Thu, 7 Jan 2021 17:32:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE9EC8D0150; Thu, 7 Jan 2021 17:32:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id A9FED6B0175 for ; Thu, 7 Jan 2021 17:32:35 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 68A802DFA for ; Thu, 7 Jan 2021 22:32:35 +0000 (UTC) X-FDA: 77680429470.05.pie27_2e0d228274ed Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 4D9F51803A138 for ; Thu, 7 Jan 2021 22:32:35 +0000 (UTC) X-HE-Tag: pie27_2e0d228274ed X-Filterd-Recvd-Size: 5228 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 Jan 2021 22:32:34 +0000 (UTC) Received: by mail-ej1-f44.google.com with SMTP id q22so11991974eja.2 for ; Thu, 07 Jan 2021 14:32:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xVA8EX3Ya3VLCzTYD/3HJV6vu9wnB8Ksxcppehb8wkg=; b=aLBwEkrzH2dog7skXswOuCmN1wVRMYhtQrVhh0cQ18YIv5bYB9fwSP2jkbCjq16RT+ 7ZkrMMH8a+h9i/8LFGi5/v1m3OdFSKYDZaVpFHUGE7g/N7Bt360Bkv1ZfSzJUBd7uOu+ izF6/BGaqMIJpf7bImRHw95nrI9Iwi165eJuE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xVA8EX3Ya3VLCzTYD/3HJV6vu9wnB8Ksxcppehb8wkg=; b=uPeNuBsSG0C5tLmGs6XN74RppVBEN4jwoCG/79W6AbF0iDcwNeKsY+A2N+TAbZ7vTy yaPvwzwEvxry4LShHMxlA/B8yIc1xl6autESTFIKIQLIMEaasGGr/fURcPsJpoW28MQb Ee+7qOlrsLIqAE3eH9uR1zj2it5eCdRq5EZk8Hd6oFMXhTUyyvAzEeDo5fz5QpxD5gi2 EDxSYU7eMEXx9RlAl715nkmGyshz7S1PerXdKsW1b4vuRtJIdefI5fyH6KtyM8OKS6Vz tBj6a+efKpj+x4W70CBR2l3ShBPXsblVI/9X4fIOXGiWXlvdoG1MAHoB4zHUASBdEmhW daDQ== X-Gm-Message-State: AOAM532VIPbpC8fDbbV/B1HvY6mltCjZHvT0Z3m9l/ne+QoU9U3jKqNi b/IvsUxB/ph9ZtrJs0ua4ePcp0kfyhiChg== X-Google-Smtp-Source: ABdhPJwMMoRDn0iCXZah/38NZPyIilIPdH88AfmYKGvbFS+wlNfd29bh5n6+AeppWZnnN5dZ/WNgKQ== X-Received: by 2002:a17:906:2681:: with SMTP id t1mr700492ejc.29.1610058753293; Thu, 07 Jan 2021 14:32:33 -0800 (PST) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com. [209.85.221.44]) by smtp.gmail.com with ESMTPSA id p22sm2906043ejx.59.2021.01.07.14.32.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Jan 2021 14:32:33 -0800 (PST) Received: by mail-wr1-f44.google.com with SMTP id d13so7082289wrc.13 for ; Thu, 07 Jan 2021 14:32:32 -0800 (PST) X-Received: by 2002:a19:7d85:: with SMTP id y127mr381008lfc.253.1610058315292; Thu, 07 Jan 2021 14:25:15 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: From: Linus Torvalds Date: Thu, 7 Jan 2021 14:24:59 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] mm: soft_dirty: userfaultfd: introduce wrprotect_tlb_flush_pending To: John Hubbard 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 Content-Type: text/plain; charset="UTF-8" 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 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