Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp935531rwj; Sat, 29 Oct 2022 13:32:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ScPu0gIB1dJ8HeTB+wt7HLoFL5tcLLtGnsQp3jHrtcs9epYd8bTPKE0a8S1VoZg5yJ8Gr X-Received: by 2002:a17:907:2bdb:b0:7ad:95e5:ce80 with SMTP id gv27-20020a1709072bdb00b007ad95e5ce80mr5244700ejc.625.1667075578916; Sat, 29 Oct 2022 13:32:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667075578; cv=none; d=google.com; s=arc-20160816; b=GRtvTkGxW03ZSTmiwdm3WXn2AqRgWrJY1GHPfq8pNzxOdEM8ApyAqOSEXrd5HSNWml A7ZPHW3fV5jub0C6jmcrPv50Dy0eGLJYTIykbq58DinZpvdAF2jqoCsRfpO7PJCrWuj0 XZp4nj86frkWGVbZYdGz9XkGPa+4OBtiEXKDx9qbtSlSVRfXRXtQp/h8djtfV05vASgg YcI0iidpicALU7XHva+lPQC5G4tQ1CgN/R96cLHwq163XfARfTEdAYm+hNxPfNBxxlZy +P7DYr9fDkARIGbORuVNYr/9d1/w08ZEEvCmaru6ODTp7aju2IdzcPF2kZyjikNMQvbK qUog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pOXPiJ97dYIJF5yPIrXfj+CbshJ1dELixNePC6rvELQ=; b=jXiiukuE+o05yC5o8KzO6y4OeqSuZTnN3PCdLZ31IW+fwVFJ9UZBpHDPevXT8Q2nlV YGT7ogDYcfZ0Fm2KVU0+Vedcu6BgnKJkV6SdNu7hMk2ZPW8NzJAyMyciAHtfeJL/VxBp rEByK8pNwTBErsLefq6z9L11Jq9yLJr9L56kyVCa8LhYj7kbExvlqNSB6JDPcoB5thCw CfU0ryll1M0+AhUk4r91bFF3DOEGIcjGfDFxsy+1QFu3mI4CSQtGvtSiIYExZftbXWs8 a/4ZCdbMyROy2dsgY+ClE5KSQm2eN+XbynPI+WUIbiXzPk7em98t/GOTPxmAtCgUbdYq JLsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=QuhkfR4D; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh6-20020a1709076e8600b0078e16203457si3054643ejc.5.2022.10.29.13.32.31; Sat, 29 Oct 2022 13:32:58 -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=@linux-foundation.org header.s=google header.b=QuhkfR4D; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229682AbiJ2UPu (ORCPT + 99 others); Sat, 29 Oct 2022 16:15:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbiJ2UPq (ORCPT ); Sat, 29 Oct 2022 16:15:46 -0400 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1614846D8A for ; Sat, 29 Oct 2022 13:15:45 -0700 (PDT) Received: by mail-qv1-xf34.google.com with SMTP id c8so6179738qvn.10 for ; Sat, 29 Oct 2022 13:15:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=pOXPiJ97dYIJF5yPIrXfj+CbshJ1dELixNePC6rvELQ=; b=QuhkfR4DG5JSax+cs/4Iz+A4JTkwrDL98mjgZZJwGTBrfhi8q29mGRVGWLSgAqOeDQ EZpgJqrD8KkrGhk77/r92K0hKjO8mLLMSpXTzkSFFrWhdMeDHM4davim/T5Pq8x0MRQ5 qoUEkHYof5agkUHAe5RZ1J/IBHxNXICf8IzeQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pOXPiJ97dYIJF5yPIrXfj+CbshJ1dELixNePC6rvELQ=; b=SczXvT/EpFzANy1RbqVPK38U5Rabw+9ETfwviXTDwkpZlePzbRkiDpCXI+1FDwbGBo HVn1thfQAgksxCvPyYDU0E7LnfoTqGquT4THMjRlZASGFp8qKaJaPU1a+viqDZGz7CZj fyQKDj2gKU1LPcBOlWSQiou+OMXvdZFG+NWk80uX6jmyGSPoRsv4un6gZCKPBHVrpFki /xxYPErz/lyyvdEl5L67EPo/h/ze7FE9unEXGtZBG6DP74/YHv4lSe5Beo3jK6CfPIv+ lvXawwqbAoFDswXBVr7/BnIWawrtsxCCSmCW1jxprkfm+1QgpwInw5pgmAGFtN/T39Oq qj7A== X-Gm-Message-State: ACrzQf03rpJci0RgnmWO/D9OZedIfsCAGNs7fa8xvdPQpt/xOPudYdNe EKk6/i0PrWSmmqXufK7k/x7+2QnQkkqScA== X-Received: by 2002:a05:6214:2505:b0:4bb:8927:872e with SMTP id gf5-20020a056214250500b004bb8927872emr4853075qvb.93.1667074543880; Sat, 29 Oct 2022 13:15:43 -0700 (PDT) Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com. [209.85.128.181]) by smtp.gmail.com with ESMTPSA id r16-20020ac87ef0000000b0039cc7ebf46bsm1233518qtc.93.2022.10.29.13.15.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 Oct 2022 13:15:43 -0700 (PDT) Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-3704852322fso5508177b3.8 for ; Sat, 29 Oct 2022 13:15:43 -0700 (PDT) X-Received: by 2002:a81:114e:0:b0:36a:fc80:fa62 with SMTP id 75-20020a81114e000000b0036afc80fa62mr5636780ywr.58.1667074542712; Sat, 29 Oct 2022 13:15:42 -0700 (PDT) MIME-Version: 1.0 References: <20221022111403.531902164@infradead.org> <2c800ed1-d17a-def4-39e1-09281ee78d05@nvidia.com> <6C548A9A-3AF3-4EC1-B1E5-47A7FFBEB761@gmail.com> <47678198-C502-47E1-B7C8-8A12352CDA95@gmail.com> <3a57cfc5-5db4-bdc9-1ddf-5305a37ffa62@nvidia.com> In-Reply-To: <3a57cfc5-5db4-bdc9-1ddf-5305a37ffa62@nvidia.com> From: Linus Torvalds Date: Sat, 29 Oct 2022 13:15:26 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 01/13] mm: Update ptep_get_lockless()s comment To: John Hubbard 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Sat, Oct 29, 2022 at 12:39 PM John Hubbard wrote: > > ext4 has since papered over the problem, by soldiering on if it finds a > page without writeback buffers when it expected to be able to writeback > a dirty page. But you get the idea. I suspect that "soldiering on" is the right thing to do, but yes, our 'mkdirty' vs 'mkclean' thing has always been problematic. I think we always needed a page lock for it, but PG_lock itself doesn't work (as mentioned earlier) because the VM can't serialize with IO, and needs the lock to basically be a spinlock. The page table lock kind of took its place, and then the rmap removal makes for problems (since it is what basically ends up being the shared place to look it upo). 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. And (b) would be fairly easy - same model as that dirty bit patch, just a 'do page_remove_rmap too' - except page_remove_rmap() wants the vma as well (and we delay the TLB flush over multiple vma's, so it's not just a "save vma in mmu_gather"). Doing (c) doesn't look hard, except for the "new lock" thing, which is always a potential huge disaster. If it's only across set_page_dirty() and page_mkclean(), though, and uses some simple page-based hash, it sounds fairly benign. Linus Linus