Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp955060rwj; Sat, 29 Oct 2022 13:59:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OGCRdGG/4ZietF9SqOn5L2sAxoIyKsyaxh6o2TBtDIrBLuQSdgKVba8FnGUHlY7mUDMpE X-Received: by 2002:a05:6402:4511:b0:45c:b2b4:3e69 with SMTP id ez17-20020a056402451100b0045cb2b43e69mr5796610edb.339.1667077178023; Sat, 29 Oct 2022 13:59:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667077178; cv=pass; d=google.com; s=arc-20160816; b=t853yqx9c19xfliuxi4bBBkg1hVZvhLAIbPrfOF5wWpCYNoO/Z+YjgI2bIwiufU1pk pbsmUoGoBZFQwFN2dOkNtgYyRmdtxuVJsFeGXqS1di3rUet5Qa6AE1AxqnR+wYXaAepC HJTqlHxsvsMcc8OKvPZg12g1f+SvC7D8rHCGlcCtqmG+IHtehy0tPK71RRhnV0mQd5wz 2L3Tsib5vc5sZaxtGDLjpOEdalivrM9FfEdnqmPxMVkifzweKNX/FJmFtCAxnM3/COyn CJlGJ/1SqWhHQQ4BwtvPnKuY9/lxPbadWlRsUAb6glYZSx1RgEadUhp5o40A0MGY7KVR yyiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=4tH8YDr8njvlRThPPAapX5SX4a61MNI+p7RjE7uY51Y=; b=rlguGC9oEuRgEKScfnEfsWCdNGw8ROQnCurTvoG19h3bjzOTgaDbjkUMv5dwfjeACf ITzjqmKgk3jwaTAfzbptWoMSHEJ7PgSOaOEwl+te1prNwiQgPmJPfiiRppfC0EpqSQF3 VeUwiL5TU9Yj6kI9x/8oWG2xZmzhM+3Z7JeY2YqWvfrIrWX+Yi0v0Q/GpuybU/LMuYiM WkGs7H/eY+/3pFG/r3zAiGhbyToFiIoYHcrP71AKy359LOBbPLfbhaUzACP1pTeKKl/J eLL3sJYou0/oWKRe7lurNVX53kF7mlpdrkc9tPqOMGewK8MqTzca7qy+u6X4Iyl8IZch T7Qw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=ZIgdOO9p; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp22-20020a1709073e1600b0078db89b2566si2989100ejc.699.2022.10.29.13.59.09; Sat, 29 Oct 2022 13:59:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=ZIgdOO9p; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229616AbiJ2Uma (ORCPT + 99 others); Sat, 29 Oct 2022 16:42:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiJ2Um3 (ORCPT ); Sat, 29 Oct 2022 16:42:29 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062.outbound.protection.outlook.com [40.107.237.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93C3E233BF for ; Sat, 29 Oct 2022 13:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mMkWVkXt9Ra0BvlWjNiBo3hO2IwhDDb3bdlPDcO1n0NcWN+QPdAk8acjAl+4FqtDtjuGzdO91N5Ez1f+m9gAHI9Fd/q/pnfiNbXeCpTNUdCXrrY9+0UdIt/ie8vLDVIhRmksfL05tPc7Ffv3xC86T9oa/8vHBr031HBL/2afu1udHbMQaAt1yNPKUSiQNpZHip5z6sZkyiPWKIqs+t2WlUwj6JFxa+L5tVqsTeqB4jd3PddXsRKf6pCEQCU/YPpJSQUW4Aq5akUdx5kq0n0RS3Vdqo0nlxh6m6YUEyeYAxt15v1vpTsJEgsANb7XBbo4yaxoSY+v5Z9+ADpNkqbmBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4tH8YDr8njvlRThPPAapX5SX4a61MNI+p7RjE7uY51Y=; b=WvPb6UJao3bI5tKoGKv6c4TFwXcQBTrv9UEVsXFnG+xFSAlgeo2DIi2Xt/RFxAHRsTnHmbtGRaBFPZs/DipJd9tnGGv8DY6It3MdNeXk9p5FXh8NjlccUgS95LrrPsM23Q1SXADCgJGblPcjw+E34EAeBhbP70ws8RTWQjDa++vp6IpixInM4E/FBXnmombFDSzwAwSDKifEG4EQfgixQ/UP0M9PxgJ1FBuGtY+uzLRQf9+wz1SVp/vRLqwpHOaSkzcGy2Lz5UdUToGJTHxcOurkYSmC1zWLC7cRjVpor97CwENcQ5BXNTFPAYPPtHIaqtAMvpkpRXEGVFX6l78rew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4tH8YDr8njvlRThPPAapX5SX4a61MNI+p7RjE7uY51Y=; b=ZIgdOO9pfC54Gqx/lzloLiyrQOVbsqoX9ASofqzpCcWDQZfwuDpXixjsPQFD+WK1Dr6F6ZIWbXZISdbTp7ZQpD7SoYvjBUT6iqkZzbabfBdRcdmLW0UqO1Uxiw9KXpC5JfsvBAaAl53uM5AmuSqoJrJpnTmbjMtFoWUIU/FIHS9Y6s++7QOYIogBOPEwDaEeXaU/VSs3Eyw8kU75NjVMosmDxVxscfdKNFimk5ltV4HVAPULLnrUCyalbVkLiK7yLvKaEe1rqpDT93mnTeNgRFIOT6oUw/tyOmtdEUXZ/dbo8qE4DRLmjRY+mh0viYLGdi68jmEB3miiRPKCAdm5bA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by DS7PR12MB5767.namprd12.prod.outlook.com (2603:10b6:8:76::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15; Sat, 29 Oct 2022 20:42:26 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::fbce:3eb5:b646:6e3f]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::fbce:3eb5:b646:6e3f%3]) with mapi id 15.20.5769.016; Sat, 29 Oct 2022 20:42:26 +0000 Message-ID: <96e49bf1-cd00-318b-c5a5-41279e223f27@nvidia.com> Date: Sat, 29 Oct 2022 13:42:23 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 01/13] mm: Update ptep_get_lockless()s comment Content-Language: en-US To: Linus Torvalds Cc: Nadav Amit , Peter Zijlstra , Jann Horn , X86 ML , Matthew Wilcox , Andrew Morton , kernel list , Linux-MM , Andrea Arcangeli , "Kirill A . Shutemov" , jroedel@suse.de, ubizjak@gmail.com, Alistair Popple References: <20221022111403.531902164@infradead.org> <6C548A9A-3AF3-4EC1-B1E5-47A7FFBEB761@gmail.com> <47678198-C502-47E1-B7C8-8A12352CDA95@gmail.com> <3a57cfc5-5db4-bdc9-1ddf-5305a37ffa62@nvidia.com> From: John Hubbard In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BYAPR02CA0038.namprd02.prod.outlook.com (2603:10b6:a03:54::15) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|DS7PR12MB5767:EE_ X-MS-Office365-Filtering-Correlation-Id: b6b4e8ef-851a-4a0d-fc3b-08dab9ee169d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TrtH+bSZe4bXrwkPZgOESMYBu/RnoNejm/xR5mQ19qrSw9gtw2+NTrNeYBKpzpmMTbF22gE7BngkFadEmeFqXhrs4hkQuC3YTpTvd2EAqq54uQc2gvhTwiuIN6t8lImLIhTzdwAdaAQkI4Fcakq/Im6aonD2bBrZ28DgZ0wuLXjbDCQUFe+9lU4JoAesubG8B+MT15vlHGOnWxE5OMKILGZNnXOeJUoJX+NAguzJb2EDRowRv1hp4X2nP0iZZXabcGib7eXAY5KVcKMSQGC2tYJTNBko0nIDOwUVPcKiUFD2Au8UxoowiCmWu2EVdk5CSnk4jFDxLNc+P9YhpCV37RvZOLS+XpgkjIAM69VxtcDR37CGadqPFg+CLI4rgwYDpo+X8KI0unI7PiDT48KR6hY9n6jMzmy64PqYBqFbeiYZ5U5ZOMLMt84jry42Oi0oTSZ1OjJZm583Ta/633ARjyLhFGB60VKYgS8gu4G5nbpWC9ge/9NHr8RLV9Ez9DO9bKqDVUzgdLsk5l7q42wkfbOJgPzK3R7rwoQlbaKANGykxaFPvHw3QrjFf+r79taxuiItvobvI/rl8CpTWtOGyS3IJks47ZH+MCVmMlbyhcL8dtUZBZvbZ2/QFcmCRvKcagqWuopnc1uOxC9kRSBwTaQVCaF46kf0+yxd3bR6O+WKY5OXTDjq0OnWv5R63eERDqEgAaIEWUJEUmWLhkmQ+euqL1DNyf2sKh5SDXDDt+NfHacJMA4rQSQ4YJG2tO99tWmA9wg/Er0m5nCj4s38jOC50YGoeRmBB1hE3p1jiOo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(366004)(39860400002)(346002)(376002)(396003)(451199015)(6486002)(66899015)(478600001)(54906003)(6666004)(316002)(6916009)(4326008)(6506007)(107886003)(86362001)(31696002)(8676002)(53546011)(66946007)(66476007)(66556008)(2906002)(186003)(26005)(6512007)(41300700001)(5660300002)(2616005)(7416002)(31686004)(36756003)(38100700002)(8936002)(83380400001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SlhlV284Q2pZTzNPTmcxSzNWLzkzWDA2eTN5ZTU5TUpqdFBrUXZRQkhNbVlD?= =?utf-8?B?bnZzdjl5b3V6WjNNckcrbXpjUXB4MGNXUGNrYU54NDBlaTdUSmt5ZXhwRXVZ?= =?utf-8?B?VHlRVVFtNkY4NEl0NDJCcWF0bU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Fl?= =?utf-8?B?RVptVE1CVzJMTXlFTU5JZ0xUN3QvcE9oZEhNVXZiMFJHdFRYMEplZTVmY2oy?= =?utf-8?B?OXhuc1VzWlEwT1F0UWZsQTIrczI0MmlUQ0pnUzRmNXZzZW5pdml4WGJPaVR2?= =?utf-8?B?dXNFMzJNYVUwYkpCSlNJMzQxWUNyWHFCRS9hUHQ4UXBIVnlpTE1RNFVpNTVi?= =?utf-8?Q?LJIjrYKOS+9cJZuzLRyR2jlyL?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6b4e8ef-851a-4a0d-fc3b-08dab9ee169d X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2022 20:42:26.0403 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9zRxYtPaUSgecM+6O6vdxBgNgXmC04wNjxUQvKcsRInQApcaHLNeEm7nQPcnOcGj+QBPFBmYxfUwlT2XZseIvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5767 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/29/22 13:30, Linus Torvalds wrote: >> I can think of three options: >> >> (a) filesystems just deal with it >> >> (b) we could move the "page_remove_rmap()" into the "flush-and-free" path too >> >> (c) we could actually add a spinlock (hashed on the page?) for this >> >> I think (a) is basically our current expectation. > > Side note: anybody doing gup + set_page_dirty() won't be fixed by b/c > anyway, so I think (a) is basically the only thing. > > And that's true even if you do a page pinning gup, since the source of > the gup may be actively unmapped after the gup. I was just now writing a response that favored (c) over (b), precisely because of that, yes. :) > > So a filesystem that thinks that only write, or a rmap-accessible mmap > can turn the page dirty really seems to be fundamentally broken. > > And I think that has always been the case, it's just that filesystem > writers may not have been happy with it, and may not have had > test-cases for it. > > It's not surprising that the filesystem people then try to blame users. > > Linus Yes, lots of unhappy debates about this over the years. However, I remain intrigued by (c), because if we had a "dirty page lock" that is looked up by page (much like looking up the ptl), it seems like a building block that would potentially help solve the whole thing. The above points about "file system needs to coordinate with mm about what's allowed to be dirtied, including gup/dma cases", those are still true and not yet solved, yes. But having a solid point of synchronization for this, definitely looks interesting. Of course, without working through this more thoroughly, it's not fair to impose this constraint on the current discussion, understood. :) thanks, -- John Hubbard NVIDIA