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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EBB3C433FE for ; Sat, 29 Oct 2022 20:15:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0631D6B0071; Sat, 29 Oct 2022 16:15:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 013458E0002; Sat, 29 Oct 2022 16:15:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E1DE48E0001; Sat, 29 Oct 2022 16:15:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D06BD6B0071 for ; Sat, 29 Oct 2022 16:15:45 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 87397160633 for ; Sat, 29 Oct 2022 20:15:45 +0000 (UTC) X-FDA: 80075092650.07.3CDBE89 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by imf09.hostedemail.com (Postfix) with ESMTP id 1F13A140004 for ; Sat, 29 Oct 2022 20:15:44 +0000 (UTC) Received: by mail-qk1-f173.google.com with SMTP id l9so5505434qkk.11 for ; Sat, 29 Oct 2022 13:15:44 -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=yrJQRlsugxucjwxQTDsEOwopcB7pZAignyBcEtS4Va1nFNuUZYotbfeAqYNfHKlzZO 2zFyUYNuCrOCOH1ZL9602TFFc7SZbTp4GCsLAYt6tbKff8kq6bdi86F7DtEYKNfvequR JcY+ns8w81TZQnGQuIUpbnoljRi2qgbqzmRyDzctdASvjT3UZ+mq1PB/MZEVlVb7moUb VZReaJ/5xlehy0iZz18PQ4BwBGBoVNOK0/AL3ID3t69yzxYzQ4B1Rv078j+lG3avUFN1 6KJJYDFTQ2Z+NaMg57nOT5Ox4fa1H+nn/z1zK4x7fw1IsXT8HODXzEC28/1RMHwCpTV/ iP+Q== X-Gm-Message-State: ACrzQf19Lqd7Bf0579KY9O/g9AenufyD7ON9XSEEtBO4HW89ye20MpQJ /qzD6WdDxurJ4BN6jqFGi+UcKt2A8JPWsw== X-Google-Smtp-Source: AMsMyM63eLXXeH6hfpPwSVhKtcQAgG9MXkjneUhr0UjOGDNLAS5qqGOiA30S2BgvQMBMaCAH2jpL0A== X-Received: by 2002:a37:a912:0:b0:6f8:77da:4a83 with SMTP id s18-20020a37a912000000b006f877da4a83mr4070476qke.284.1667074544030; Sat, 29 Oct 2022 13:15:44 -0700 (PDT) Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com. [209.85.128.176]) by smtp.gmail.com with ESMTPSA id 17-20020a05620a071100b006fa11a057f4sm1630201qkc.68.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-f176.google.com with SMTP id 00721157ae682-368edbc2c18so75685437b3.13 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667074545; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pOXPiJ97dYIJF5yPIrXfj+CbshJ1dELixNePC6rvELQ=; b=pEBu8u5HUPR6pGZHicpuUDqza9Zz2JsWDIxSOs3mv87JFn0hpvupEuWIkjcvilewV5CFxk qusKhch6D/fxm4LmywSea4SNFTdEdwhofAGPocp3zK6lKA9O0WZTjroIMUKTqM8A6TPeJt VKAT6D6tSk5oQqq1J60m4XgE4rKVFzk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=QuhkfR4D; spf=pass (imf09.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.222.173 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667074545; a=rsa-sha256; cv=none; b=x45DBFmxRtCrx3CgGiV97iqJiTnzW/UfIGCMipco3vmmM69Wlwb5x/0/Yne+mzDIXkbdNb blyO6O3MptHVO3L3xRK8nISBnreKqhDQ3kvV5KegBvBwxV9GTdyLUUURkSfWPit02cib4j pL6jrCHKfOyVmy+/WvFTrfNfsqSge18= X-Stat-Signature: pbcqby6q8eh38np3dmer36ozefkbdtm4 X-Rspamd-Queue-Id: 1F13A140004 X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=QuhkfR4D; spf=pass (imf09.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.222.173 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none X-Rspamd-Server: rspam04 X-HE-Tag: 1667074544-876575 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 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