Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2394585pxk; Mon, 14 Sep 2020 12:07:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjcMeXrt+HmU/mj4QdneoypquFyJKVLtNWHvPthbwOm31AixEgGdPKpqlh+MC+Cew0hgf1 X-Received: by 2002:a17:906:4cc2:: with SMTP id q2mr4043218ejt.422.1600110449569; Mon, 14 Sep 2020 12:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600110449; cv=none; d=google.com; s=arc-20160816; b=ESRI019/b1Dm5zNyZ2fxP8N8l6tDbXLRWs9BDOKwbq11rBv/oD9Bn56DkZNKVPmtCg wmGZ5/QFCiK6FZ3HOpVLWi76bAo4We3XZY+bVVQN2Ur98ZmfQmu11rQDbYGkOugTL8Pe 7IdHam5QVz6Nb1P6JubtF+s8mHPIGtAAigSeSpF39CNbtF4e0d2d5f1kK36JWZNxh86e mcskkJ2syZHnFTbhf9c7Z3dTlVfc83BVknbhsZ82U8SHPl9AU9ZpXcOktyCjhnfUu6s+ czHHe0FM7110bNonsfFvt/xtXI1rfuYJEUN8U0M8mS9KdWsyIu0yJM8Y13HPxOlYYxnL 2olQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/lCp3kDrA6QrcbGyjex2I7KUZqi/r0wV3gacvDIaE78=; b=x7Q6GS9F8EeS1VvkwMaig9kzerR9FfRozlGY9R/BUCv57vI5OTlZwGba09JSusC9zl zd4ELgFbLqKKPV5iEUBpVSCC8AWovo2dla4O2yTFO7EIcglJ9GNRcmtncsr3tLCqL2IE rrJAehFG0gJW9NNWMrPrHhS1j3f4Px2Ms/OllXme+J0cxorMcfgvwhxCrTIrQ6nS8oy6 EmC/Mwui/dCSGGqOaPraiXZZuBY6TOM9WvZOuPNQFZheAt8o1OOujUDVMRAW/Fqgw/4E ZNbIot1BtrGYOgG7UdLgP50j15NTbatm6jbXs7gKi4SSzkfQT8vpQnkD3AQH0SUuin/E bllQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=HG8R+P0w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ly5si5692484ejb.500.2020.09.14.12.07.06; Mon, 14 Sep 2020 12:07:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=HG8R+P0w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725987AbgINTD4 (ORCPT + 99 others); Mon, 14 Sep 2020 15:03:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725953AbgINTDy (ORCPT ); Mon, 14 Sep 2020 15:03:54 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15EB0C06174A for ; Mon, 14 Sep 2020 12:03:54 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id m5so429954lfp.7 for ; Mon, 14 Sep 2020 12:03:53 -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=G9+KaojTx3EM4L45qTTpxKhB1ouHVLtaT6/3OPBr34WFygo3tQHoJ0F0IRgbw9kpl7 fTmT2iKyp4ap1IIU2TkE+Z24biM8l64gZjjtzNmOR25QdtG4AzpC9Ju0rLiFCU04VSpy t490yI2+SEr7E5a/kZQU11aqBCrGQujm4EKu+uyqJzKvCsgUAauNwI5kX+qG0Zfg+2Xy lePRU9rcjinW/gCxVoqzPj9lp2I3lBqGpM7IojPPCh42lORnluZ6Paz2HVklmOlpLKSe 3Um5sAevnpAuWU+7lJ03RqtDwK4Gg2NxJRSEp50i+SnCmbxXl5kWWGii/81skPazKuS3 5ndg== X-Gm-Message-State: AOAM531Xm47nulyAxYWtUvkqt3nVa6E0O/E5WwRpVQeQ/0x62+quYLiG 3OI5TC+ZcbE51XmsPsunfABFegs1hmgpzg== X-Received: by 2002:a05:6512:3f3:: with SMTP id n19mr4345404lfq.531.1600110232156; Mon, 14 Sep 2020 12:03:52 -0700 (PDT) Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com. [209.85.208.182]) by smtp.gmail.com with ESMTPSA id m10sm3520757lfd.134.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-f182.google.com with SMTP id r24so636776ljm.3 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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