Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp21254rdb; Mon, 22 Jan 2024 10:33:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEBYhs71ctV1qz3S1gk+7xqRwMQr/uXkBYlgB+5GO2NrCP8F/6zO8UvE8NzcFuxPrmvoLBE X-Received: by 2002:a17:906:1d54:b0:a26:88f4:3fae with SMTP id o20-20020a1709061d5400b00a2688f43faemr2488962ejh.67.1705948406310; Mon, 22 Jan 2024 10:33:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705948406; cv=pass; d=google.com; s=arc-20160816; b=yjvmBkfoK05f4tkWIULPJiC+WcD5DM6Wj+yW3I8Um3DbdxoaaydLC/8SUsoy+wFHMQ 9/3MAZDLEn+0J+9IpzwzpY3bz84HXM87GKX+KFdsw9Lb0sSmdQN78drwTM5tanUqiT3m /bf5HD0el8ZOEp5pVEVBlA3Gpy+r7e0Dic5i4ss+Krl8eKhHx6BZErOROlCC77B9ZUj5 AkGMiWlNEIrT+5uCDu75UiYO42gnc9U6csY5AsBlUUoU5Mj4rUF1JEoDrfc/V1Kwvg8r 07lSBjE6AQftc0AVJZfkQqCvHOIEIeRyRKA15b/EPPaz2YJiFFzTcq3sG43w/ptulG6p fB6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ffjimZag3duj0z7SQ/ynHQbRhQyfj6VmeeSdQ1qniX4=; fh=Ge3TG+kO1azMA/cqLqJt1oAiBY2KHRuerY1trt8voX4=; b=PRN4e4JZ3ef1IGG4dsMOGfQcbeWPOQvHvFp/g1aXFMo3n4wsxemnxLuk/V0Bjtu1xl YllmyFz6uaXn3PT46blSKoyUDSUUvErRqEAd2NASs5djUlVvEw1tn+Z0w9zM3ky1mqQb lmJ2lfPtsfKls28/48W6v9OSl3Ur8HiADgifDgNSZbe+Fwp3uBRE13y/3ubvC/OGNZNk hV77HODPUltwndCwy5BxNWWxBuK8LOS2vz0X40wXnOoZ2qFB5oNxUtWJyYoF8U8Pxz+r i3Ar2uOIqsiRhrMleDm23GmuwuIEWvWuCY8SSiikfVOM3I8c1T/3rmKCY5XDUa3plyFz /uvw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=VuT1zM71; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-33824-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33824-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k5-20020a17090627c500b00a26a9680e48si11059932ejc.128.2024.01.22.10.33.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:33:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33824-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=VuT1zM71; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-33824-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33824-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0642B1F2CDEA for ; Mon, 22 Jan 2024 18:08:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B9705674C; Mon, 22 Jan 2024 17:32:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="VuT1zM71" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3CA256743 for ; Mon, 22 Jan 2024 17:32:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944757; cv=none; b=lD1v+K+7cc7SxlEjxLm1f0MdIgHeePSPuSA9mWcIXSZRB5tfaVRIqSHe/AheDhp+nvCafiz3l8WdDUFUJHh/XQJWYDXF9hrJe7tjaZ8ptzXUG2Fd6BF4TfjtU0d2SGGYi5tl74LYDxntc/W6PZcI5HCzr2aBpOFYevJYWPMWLwk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944757; c=relaxed/simple; bh=DO8NTrgfc4HqCUVR3zw2WBLs3BibO1sk1S45PfcjkKk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jwJZFGodnBUZXhJK6wDL5ELsKDZWxXp6e5aeWsHCstASHPWFAJqdWoKAnVLqG27wird0q9p5PuHTs4braqPlhG0EicIBkrBWZo8Zwc0X2fuVnA0Xb0BjUpz9zob3o/bEPms8O2twSKnK/BCzRpWeEyEwe3WAit5Iud8L6AprwWQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=VuT1zM71; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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.