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 B5F41C47DAF for ; Mon, 22 Jan 2024 17:32:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B4628D0005; Mon, 22 Jan 2024 12:32:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 364F28D0001; Mon, 22 Jan 2024 12:32:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22DB48D0005; Mon, 22 Jan 2024 12:32:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1280E8D0001 for ; Mon, 22 Jan 2024 12:32:39 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D3FAC40A07 for ; Mon, 22 Jan 2024 17:32:38 +0000 (UTC) X-FDA: 81707641596.11.5B30672 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf20.hostedemail.com (Postfix) with ESMTP id 17C641C0023 for ; Mon, 22 Jan 2024 17:32:36 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=VuT1zM71; spf=none (imf20.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705944757; 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=ffjimZag3duj0z7SQ/ynHQbRhQyfj6VmeeSdQ1qniX4=; b=Ab9TBpP0hDz4zQ0G5Q828cr9TnQI3aeXlrpBnvfl5wWgAuM1rtZXWQ7HbBi/E2RqHqYt/n fKigstZ3kO0NvPybC2fJW+BgaOMNhvhxoOWVkIxsN0AwDQeGXrQ7lwtNwcqWxhrcW7hx/o HOhnFTnThit5iji2GywF0ahT1ViMFI4= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=VuT1zM71; spf=none (imf20.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705944757; a=rsa-sha256; cv=none; b=6hmnoAB58iMF+mI6/fW16XwnCM7VzQi4teXGQ5InjWY7PDKmO/E5HABslTmrlac339kM5P owrUhgsntmogtX9RQAuYH8PckXZ8YHzU81VvWs2xOZ3G0ySoj8qncNPcSGuVMhBj0QPHBs joNXlAC0qTaWf6c6DSgenXOoezlzUbI= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ffjimZag3duj0z7SQ/ynHQbRhQyfj6VmeeSdQ1qniX4=; b=VuT1zM716OnFaEMTxjmmBUK4il RoZivoynyI45CYLoCRZmqiKtnwPGNvCyG3dNDSkGqLWSmMKQIxaMbOMEZCVB0dp2slbZzghsjYENN P9vtMQybR6eM2WYbtLBJQ2hPSlfCLKblfewYBTDV73fj4gHJxlKvQB7Og4/oMF+QSOMq9RPN9sLQP OwIJ6uTHOE0I/ERe9s2kA2l+nMsObHnDtyMD35/8NX5yCH2TYzE1Oqzk3s0nOmDckI2D4AQWgl7wD Pc5r6pjprq39jHLNaiocQLj8V8ibSL9C9o74HYbC0i68JshFoEIJiOUaRwVJH+6UU6O8yfC1Rn3TU 2BR4LRCg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rRy9v-00000000Xhw-2rDo; Mon, 22 Jan 2024 17:32:31 +0000 Date: Mon, 22 Jan 2024 17:32:31 +0000 From: Matthew Wilcox To: Ryan Roberts Cc: David Hildenbrand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Hugh Dickins , Yin Fengwei , Mike Kravetz , Muchun Song , Peter Xu Subject: Re: [PATCH v2 28/40] mm/memory: page_remove_rmap() -> folio_remove_rmap_pte() Message-ID: References: <20231220224504.646757-1-david@redhat.com> <20231220224504.646757-29-david@redhat.com> <2445cedb-61fb-422c-8bfb-caf0a2beed62@arm.com> <007e83fa-16c7-4700-b326-ee8cb7809f9f@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 17C641C0023 X-Rspam-User: X-Stat-Signature: mas6uhswdsrrctk56x149w556kdgcprq X-Rspamd-Server: rspam01 X-HE-Tag: 1705944756-267063 X-HE-Meta: U2FsdGVkX1+MJ3MwUW3lFvr44hkp8obe8WmJJKtP6HyrCX52cFK7ITGx4qsNUl5Tbggx0kTeFaqSWMtqE6/Xe8P9FMYKuJgQyNI+q+QpGMTP7Bfm1CQH/qr+ze+EG6PIfR8r6w3GsiQ1S1dq4zHqsACzCYQjtW6j0z6LoeetYRUiuP/irKX6eCzfhyDfrL4ERmJOUWZ3tfk/GxTC5UfYkOx3pZ5wOKTSjwuDqmVOlSYL/sWA0ZndSdD4Mv6tyvWmnuQIYcjuiRxKQ31QjLMWjv937Zj1vMfM3bBil2vTES8lEmNN68UUHU8bnScIIJhrhARSUbbANymfuigQ4QvjJbrvg72OwJjhx8UO+GQvsam4WZu3DVKyTfCXqtXraNks14AZ7ttP56bAusfNAj/DNrRmzM4jEqehTC3Nn96zOcZE4LjK4Qaa63sR7e1wpsmE5BE5UafgyDJAG7y3egPxfooGx86IJ8zm6nZ0mOaIw39Hpa0MwX1erY/tDLfeLnkKIaFBha+mbABIlbwVV6miPtylDIb6aDaICx6jOy3h251vEdV/elPDfV1gftM8iyFcjzvkH8A0fJlD2Ev8jFZ72bGbidO7+hh+5/YVLUVwbDITskO6BP20KCVWnMbtHNRdgY+Qois+ar3kgpyHx5hfOdCqoz+lnbCw/Ii7VYkxcYRGKIWNgRAwieSskdBpSC35hSYisWmkUgVnCvFEuO+/kCNjuZ5KxwIdT5homhhz7Mtr4xFJf4tnLwePEwVdDFPKOQ90J2hT7nUJmRFxgAGGTXRMAz4JLTg9HUpPaeA0I74+YxP2EYMNuv+FboYp/PWsYFhKOhvst+2Ty6u1UyklLcmU1OoJMjuL2v2S1yq92xFLYQq2F0fR12sV0haBL6JBBDYX4yaSX7WmwC9/L9XHHSOUonjrr7Pboy4jCBQII4DZ7VYA1gpfFSlmj2LO3JFf9KVk4e1799bD5G+Lfv4 4FdiLdTn sWkl76sG6Qd9F6QypL7J814MjtTdyHH4nJi5I4fRP9IyruWs0/1ofaTBRxvMZJM7WIABcQhfptcZz6YmbWVWJdy2FBnXDaD7oHdbRfVAYUhdMSbfiO2CZpLhPAd5aFtXErudiUZpno0N4iYO4xzbHfMeRw41UG4gDb2rlVKlQ2Wjsk04rp4JQCx+bYw== 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: List-Subscribe: List-Unsubscribe: On Mon, Jan 22, 2024 at 05:26:00PM +0000, Ryan Roberts wrote: > On 22/01/2024 17:20, Matthew Wilcox wrote: > > On Mon, Jan 22, 2024 at 06:01:58PM +0100, David Hildenbrand wrote: > >>> And folio_mark_dirty() is doing more than just setting teh PG_dirty bit. In my > >>> equivalent change, as part of the contpte series, I've swapped set_page_dirty() > >>> for folio_mark_dirty(). > >> > >> Good catch, that should be folio_mark_dirty(). Let me send a fixup. > >> > >> (the difference in naming for both functions really is bad) > > > > It really is, and I don't know what to do about it. > > > > We need a function that literally just sets the flag. For every other > > flag, that's folio_set_FLAG. We can't use __folio_set_flag because that > > means "set the flag non-atomically". > > > > We need a function that does all of the work involved with tracking > > dirty folios. I chose folio_mark_dirty() to align with > > folio_mark_uptodate() (ie mark is not just 'set" but also "do some extra > > work"). > > > > But because we're converting from set_page_dirty(), the OBVIOUS rename > > is to folio_set_dirty(), which is WRONG. > > > > So we're in the part of the design space where the consistent naming and > > the-obvious-thing-to-do-is-wrong are in collision, and I do not have a > > good answer. > > > > Maybe we can call the first function _folio_set_dirty(), and we don't > > have a folio_set_dirty() at all? We don't have a folio_set_uptodate(), > > so there's some precedent there. > > Is there anything stopping us from renaming set_page_dirty() to > mark_page_dirty() (or page_mark_dirty())? For me the folio naming is consistent, > but the page names suck; presumably PageSetDirty() and set_page_dirty()... yuk. Well, laziness. There's about 150 places where we mention set_page_dirty() and all of them need to be converted to folio_mark_dirty(). I don't particularly like converting code twice; I get the impression it annoys people. The important thing is what does it look like when someone writes a new filesystem in 2030. I fear that they may get confused and call folio_set_dirty(), not realising that they should be calling folio_mark_dirty(). It doesn't help that btrfs have decided to introduce btrfs_folio_set_dirty(). I think MM people can afford to add a leading '_' to folio_set_dirty() so that's my current favourite option for fixing this mess.