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=-4.1 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 A077BC433E0 for ; Mon, 10 Aug 2020 23:19:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 51855206C3 for ; Mon, 10 Aug 2020 23:19:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="esYya08x" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51855206C3 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 BDF5D6B0008; Mon, 10 Aug 2020 19:19:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B68386B000A; Mon, 10 Aug 2020 19:19:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A09F46B000C; Mon, 10 Aug 2020 19:19:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0051.hostedemail.com [216.40.44.51]) by kanga.kvack.org (Postfix) with ESMTP id 8724E6B0008 for ; Mon, 10 Aug 2020 19:19:29 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 282974DD5 for ; Mon, 10 Aug 2020 23:19:29 +0000 (UTC) X-FDA: 77136227658.28.room68_3f078e126fde Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id E92546C2C for ; Mon, 10 Aug 2020 23:19:28 +0000 (UTC) X-HE-Tag: room68_3f078e126fde X-Filterd-Recvd-Size: 4796 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Aug 2020 23:19:28 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id t6so11459038ljk.9 for ; Mon, 10 Aug 2020 16:19:28 -0700 (PDT) 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=Ah+VgQKs3kGLd4LAiDMSL98AvAsoBiO7tyrewnreXwk=; b=esYya08x10kt09r0pEU6JYyN4Jrr4Dl28/5LaoSkW4HUwhcTM5CJAEWFZupbTAmaQ1 ZZKmXj+7iSZT6wXP76iylAVzzkhrCCKw/iBUjX/3mPKvlEBsz5hnZTCSvWHXVl0iscb1 aKLPgRFTDyRDP9spyUQc4L/EJcBVTMGXgMItM= 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=Ah+VgQKs3kGLd4LAiDMSL98AvAsoBiO7tyrewnreXwk=; b=aiH0ps++lVROCs2g39l+y3RD8S5++xz+cmuMEshScjWz0PjhCxmNJmL+fxplUtE70w jDYYeXGHV702/pZqjHZDcPI+0NM6iZXukggt4JhEwo5IPOMfVy6g5Ld9XZTfvUNa5Ai7 ZJ7EYIh71QDnwZZXW1L+1rpnvS1C495eoRpUcO04DxAlefJf0Jnu256rf4jj8eo5eDKy afkKxTpBgF1kKYrij2hicIsplxfzN8juP80VL7TXslE2v1fX9c/VGGa5bJ9UC4o2wUNG 0rS1+wm2YS16i2OMWGYBphOyVZ2M7RqeQ7fb544C0KP4RzBTntxJwpWFFUQerMvYZb8z NYZg== X-Gm-Message-State: AOAM533MtMIVyQBHj4e0drL89CIH8nD9xdCR8duPu1A5zjLtPodaVz/+ nknVsoAUrxF1Z2we5dVmSu5T5XrJAE0= X-Google-Smtp-Source: ABdhPJxs2bcaboPHZRU2M+78dWBdlNhQwq7+NZKE12IVDUZJdniHdEt9/QVhAeeVzaPk80F1Ma1+oQ== X-Received: by 2002:a2e:96d9:: with SMTP id d25mr1776958ljj.408.1597101566150; Mon, 10 Aug 2020 16:19:26 -0700 (PDT) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id a14sm9539697ljb.29.2020.08.10.16.19.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Aug 2020 16:19:24 -0700 (PDT) Received: by mail-lj1-f176.google.com with SMTP id w25so11440708ljo.12 for ; Mon, 10 Aug 2020 16:19:24 -0700 (PDT) X-Received: by 2002:a2e:b008:: with SMTP id y8mr1446926ljk.421.1597101563687; Mon, 10 Aug 2020 16:19:23 -0700 (PDT) MIME-Version: 1.0 References: <20200810145701.129228-1-peterx@redhat.com> <20200810191520.GA132381@xz-x1> <20200810215734.GB132381@xz-x1> In-Reply-To: <20200810215734.GB132381@xz-x1> From: Linus Torvalds Date: Mon, 10 Aug 2020 16:19:07 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] mm/gup: Allow real explicit breaking of COW To: Peter Xu Cc: Linux-MM , Linux Kernel Mailing List , Andrew Morton , Marty Mcfadden , Andrea Arcangeli , Jann Horn , Christoph Hellwig , Oleg Nesterov , Kirill Shutemov , Jan Kara Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: E92546C2C 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, Aug 10, 2020 at 2:57 PM Peter Xu wrote: > > Yeah, that's why I totally agree we need to do enforced COW even for a read gup > as long as the page can be further referenced (GET|PIN). However frankly > speaking I didn't follow the rest on what's wrong with "Userfaultfd-wp should > not care about this because it's not a write operation" that I mentiond. Is > that the major part of the objection? You didn't _explain_ why it's ok. You said "it's only reading". And I told you why "only reading" is not an argument against COW. So my objection is that you haven't actually explained why it's ok for userfaultfd-wp. I can easily believe that it is, but my whole point is that this is subtle, and it needs documentation and explanation. That's also why I think the bit should be the other way: the people who need to explain are the ones that disable COW, and the reversed bit would mark that case. The people who are ok with COW don't need to explain anything, and for the same reason I think they shouldn't need to add that FAULT_FLAG_BREAK_COW. See what my argument is? It's entirely about documenting the special case. Linus