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 2D0EAC433E2 for ; Mon, 14 Sep 2020 19:03:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 89068217BA for ; Mon, 14 Sep 2020 19:03:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="HG8R+P0w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 89068217BA 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 CD7786B0002; Mon, 14 Sep 2020 15:03:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C62CD6B005D; Mon, 14 Sep 2020 15:03:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B2B616B0062; Mon, 14 Sep 2020 15:03:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0166.hostedemail.com [216.40.44.166]) by kanga.kvack.org (Postfix) with ESMTP id 97BD86B0002 for ; Mon, 14 Sep 2020 15:03:55 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 54A31180AD81A for ; Mon, 14 Sep 2020 19:03:55 +0000 (UTC) X-FDA: 77262591630.20.bikes90_34183452710b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 23BDB180C07AB for ; Mon, 14 Sep 2020 19:03:55 +0000 (UTC) X-HE-Tag: bikes90_34183452710b X-Filterd-Recvd-Size: 4298 Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Mon, 14 Sep 2020 19:03:54 +0000 (UTC) Received: by mail-lf1-f67.google.com with SMTP id u8so467876lff.1 for ; Mon, 14 Sep 2020 12:03:54 -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=/lCp3kDrA6QrcbGyjex2I7KUZqi/r0wV3gacvDIaE78=; b=HG8R+P0wSkEFRTNr8Mv0Y10m6YvFO4YVFnMbSV3dBmCQG5Sqh0vfpcFYZoAJ4ARtXB 5Nl6BJA4HVzuKfa0PXfluHX2neScJKXnlRAYpbYXR9s81/gcyFkkCpU+STIyvw4WvIAQ aD6eLgkUim5q6a9apDodAYNIOMXsCWGNBsoyo= 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=/lCp3kDrA6QrcbGyjex2I7KUZqi/r0wV3gacvDIaE78=; b=qIokMyYN1OlP3HE4e11OrrW6hE+o0fudqAG2+0p+H5YA00NK3Zzg/j6JDsmFLdD1ay zQ8hv98zQnd7yTolysud/jDRlmkv7f3noixvCql8wpCwfH7qaxDD+jpZXzXfNWJchmhA gcWGdnTG8/f4jvRCjeLWmsRshpP0js46zXPRQI5DWmJ6qs8xCyQlDJpjfdD93dLe/BEQ jqfNQdPAf1BQbAWP06WtKKeDjJGVD97O+nHTrfGL6/0YonKQCkoqgOFWmsf+3Xg+IXOk wUKbqCpWhYBGtu65hxFgdAuu0cOoVh5uUr8efhh3FC1hDthdpOqzGdDw3a0t7yINaIC0 eoVQ== X-Gm-Message-State: AOAM530Nq0CezCI0y8zQlSgP0zAVNQviR0ZDnPu0I2jVFAArx9mu5V0F BzXTpyhSQjrAAcO5WT98EEXdO+NSOnXVyg== X-Google-Smtp-Source: ABdhPJxi1PXl9qebBxDTPr7Nju3qY8ehkyHvCJrAXgCS5cjBp6bf6fuWcpcOaU4EclGQEXg1/q+Kjw== X-Received: by 2002:a19:e4c:: with SMTP id 73mr5189367lfo.286.1600110232363; Mon, 14 Sep 2020 12:03:52 -0700 (PDT) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com. [209.85.208.179]) by smtp.gmail.com with ESMTPSA id v16sm4208429ljc.84.2020.09.14.12.03.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Sep 2020 12:03:51 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id c2so581138ljj.12 for ; Mon, 14 Sep 2020 12:03:50 -0700 (PDT) X-Received: by 2002:a05:651c:104c:: with SMTP id x12mr5938341ljm.285.1600110230596; Mon, 14 Sep 2020 12:03:50 -0700 (PDT) MIME-Version: 1.0 References: <20200821234958.7896-1-peterx@redhat.com> <20200821234958.7896-4-peterx@redhat.com> <20200914142722.GA21906@redhat.com> <20200914175946.GC30881@xz-x1> In-Reply-To: <20200914175946.GC30881@xz-x1> From: Linus Torvalds Date: Mon, 14 Sep 2020 12:03:34 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/4] mm/gup: Remove enfornced COW mechanism To: Peter Xu Cc: Oleg Nesterov , Linux-MM , Linux Kernel Mailing List , "Maya B . Gokhale" , Yang Shi , Marty Mcfadden , Kirill Shutemov , Jann Horn , Jan Kara , Kirill Tkhai , Andrea Arcangeli , Christoph Hellwig , Andrew Morton Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 23BDB180C07AB X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 14, 2020 at 10:59 AM Peter Xu wrote: > > However now I'm a bit confused on why FOLL_COW must be with FOLL_FORCE even > without the enforced COW... Shouldn't FOLL_COW be able to happen even without > FOLL_FORCE (as long as when a page is shared, and the gup is with WRITE > permission)? Not sure what I've missed, though. Afaik, the FOLL_FORCE test was (and is) unnecessary. If FOLL_COW is set, we're going through this the second time, and we either had that pte_write() or we had FOLL_FORCE originally. So can_follow_write_pte() doesn't need the FOLL_FORCE test - it's redundant - but it isn't technically wrong either. Linus