From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 D12AB44780F for ; Wed, 12 Aug 2026 13:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=96.67.55.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786539738; cv=none; b=WBgN5DLlKjik7KaU8qynvzlPvbF3oh2p3/vS17iJSZHnSvfnzSBKYnPqVZhmY16W17dYwxohi3Jt6vPtKt5dlTNfnjkeR61tJQmV1H10PCOlTCLpnSWo3wCauQVx1v73yKbKjH7NeOAHLvzdsO9GJNb6PW+wIbymgBnWxYtUJmc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786539738; c=relaxed/simple; bh=3afadaQWMy7CXc8uhs8r6Sfs6URxGbACL7mqS2X/ou8=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=MWVSAFq0CJLhnY4e9/M9LHOpNtrCl/t7yA1SkrMN0iSXbCPzBYISKzumybnx13XoDei+ZoIGK8hxY6dh69SodOFdLgGf/GuodummCi+3K5AoEwDVL4VC6XTRijPuCS/+hfI4fVVkir+k0DpH17IhT0PWzUi2HzijnQaDwyNOGsI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=surriel.com; spf=pass smtp.mailfrom=surriel.com; dkim=pass (2048-bit key) header.d=surriel.com header.i=@surriel.com header.b=HgJdg8uu; arc=none smtp.client-ip=96.67.55.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=surriel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=surriel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=surriel.com header.i=@surriel.com header.b="HgJdg8uu" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=surriel.com ; s=mail; h=MIME-Version:Content-Transfer-Encoding:Content-Type:References: In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=3afadaQWMy7CXc8uhs8r6Sfs6URxGbACL7mqS2X/ou8=; b=HgJdg8uuNv7b1rrcSdXBbj1MTK ZjMQbPpaREu1sUMqCaTcc0geR+tY7OMvF1cGa0I4zkFPHKkdSUjX6qCykS8fhoYNOWKM4zlB2nSHS kUNMkq2Ixw7wUtfN5wqBDeu5XcqC2wXRsxieXlOadYscpLROe0xNqBBy0u3rXu8Cw5xXU6TUQQhJy z9bi9odZn6NbFFXvfCfap8eEfZ75/Axhnzy45NnEl7pW6AhUlZkj1TNdfJENkN4Pt4+Tn4dmDtjCo e4WSLSWu6ERMeuCqdI32TDnkkXW2stmHYtQglwmeqzEPiwINC6+72yq3uoh7L41Ft4wq4Yd210pgy XNFoMp4Q==; Received: from [96.67.55.146] by shelob.surriel.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.99.5) (envelope-from ) id 1wu8ar-000000007WD-1KH1; Wed, 12 Aug 2026 13:02:05 +0000 Message-ID: <30b747de6202cd875b7669f8d76ad8ded5c0a4e7.camel@surriel.com> Subject: Re: [RFC PATCH v3 3/8] mm/gup: split follow_page_pte_commit() out of follow_page_pte() From: Rik van Riel To: "David Hildenbrand (Arm)" , linux-kernel@vger.kernel.org Cc: kernel-team@meta.com, Andrew Morton , Jason Gunthorpe , John Hubbard , Peter Xu , linux-mm@kvack.org Date: Wed, 12 Aug 2026 09:02:05 -0400 In-Reply-To: <8a9d5a6f-a7c6-468f-8b50-a7aa2b4dea2c@kernel.org> References: <20260811025157.1632867-1-riel@surriel.com> <20260811025157.1632867-4-riel@surriel.com> <8a9d5a6f-a7c6-468f-8b50-a7aa2b4dea2c@kernel.org> Autocrypt: addr=riel@surriel.com; prefer-encrypt=mutual; keydata=mQENBFIt3aUBCADCK0LicyCYyMa0E1lodCDUBf6G+6C5UXKG1jEYwQu49cc/gUBTTk33A eo2hjn4JinVaPF3zfZprnKMEGGv4dHvEOCPWiNhlz5RtqH3SKJllq2dpeMS9RqbMvDA36rlJIIo47 Z/nl6IA8MDhSqyqdnTY8z7LnQHqq16jAqwo7Ll9qALXz4yG1ZdSCmo80VPetBZZPw7WMjo+1hByv/ lvdFnLfiQ52tayuuC1r9x2qZ/SYWd2M4p/f5CLmvG9UcnkbYFsKWz8bwOBWKg1PQcaYHLx06sHGdY dIDaeVvkIfMFwAprSo5EFU+aes2VB2ZjugOTbkkW2aPSWTRsBhPHhV6dABEBAAG0HlJpayB2YW4gU mllbCA8cmllbEByZWRoYXQuY29tPokBHwQwAQIACQUCW5LcVgIdIAAKCRDOed6ShMTeg05SB/986o gEgdq4byrtaBQKFg5LWfd8e+h+QzLOg/T8mSS3dJzFXe5JBOfvYg7Bj47xXi9I5sM+I9Lu9+1XVb/ r2rGJrU1DwA09TnmyFtK76bgMF0sBEh1ECILYNQTEIemzNFwOWLZZlEhZFRJsZyX+mtEp/WQIygHV WjwuP69VJw+fPQvLOGn4j8W9QXuvhha7u1QJ7mYx4dLGHrZlHdwDsqpvWsW+3rsIqs1BBe5/Itz9o 6y9gLNtQzwmSDioV8KhF85VmYInslhv5tUtMEppfdTLyX4SUKh8ftNIVmH9mXyRCZclSoa6IMd635 Jq1Pj2/Lp64tOzSvN5Y9zaiCc5FucXtB9SaWsgdmFuIFJpZWwgPHJpZWxAc3VycmllbC5jb20+iQE +BBMBAgAoBQJSLd2lAhsjBQkSzAMABgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRDOed6ShMTe g4PpB/0ZivKYFt0LaB22ssWUrBoeNWCP1NY/lkq2QbPhR3agLB7ZXI97PF2z/5QD9Fuy/FD/jddPx KRTvFCtHcEzTOcFjBmf52uqgt3U40H9GM++0IM0yHusd9EzlaWsbp09vsAV2DwdqS69x9RPbvE/Ne fO5subhocH76okcF/aQiQ+oj2j6LJZGBJBVigOHg+4zyzdDgKM+jp0bvDI51KQ4XfxV593OhvkS3z 3FPx0CE7l62WhWrieHyBblqvkTYgJ6dq4bsYpqxxGJOkQ47WpEUx6onH+rImWmPJbSYGhwBzTo0Mm G1Nb1qGPG+mTrSmJjDRxrwf1zjmYqQreWVSFEt26tBpSaWsgdmFuIFJpZWwgPHJpZWxAZmIuY29tP okBPgQTAQIAKAUCW5LbiAIbIwUJEswDAAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQznneko TE3oOUEQgAsrGxjTC1bGtZyuvyQPcXclap11Ogib6rQywGYu6/Mnkbd6hbyY3wpdyQii/cas2S44N cQj8HkGv91JLVE24/Wt0gITPCH3rLVJJDGQxprHTVDs1t1RAbsbp0XTksZPCNWDGYIBo2aHDwErhI omYQ0Xluo1WBtH/UmHgirHvclsou1Ks9jyTxiPyUKRfae7GNOFiX99+ZlB27P3t8CjtSO831Ij0Ip QrfooZ21YVlUKw0Wy6Ll8EyefyrEYSh8KTm8dQj4O7xxvdg865TLeLpho5PwDRF+/mR3qi8CdGbkE c4pYZQO8UDXUN4S+pe0aTeTqlYw8rRHWF9TnvtpcNzZw== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.2 (3.60.2-1.fc44) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Wed, 2026-08-12 at 13:50 +0200, David Hildenbrand (Arm) wrote: > On 8/11/26 04:51, Rik van Riel wrote: > >=20 > > +/* > > + * The caller has already run every per-PTE safety check (present, > > + * write-fault, gup_must_unshare()) on the PTE, so this only does > > the > > + * per-folio work: the refcount grab, the FOLL_PIN accessibility > > fault-in, > > + * dirty/accessed marking, and the array fill with the cache > > flush. > > + */ >=20 > If a function needs 4 lines of internal doc to understand what it > does, then > maybe it's not the right function name or abstraction. :) >=20 > I don't particularly enjoy the "commit" terminology, it looses the > detail of the > most important thing this function is supposed to to: grab a folio > reference. >=20 Should we rename it to gup_grab_folio() ? > We're passing in the pte only to do a single pte_dirty(). If the > helper is > actually what we want, likely we just just pass in the pte_dirty() > directly and > remove all pte leftovers from the helper. >=20 > I'd assume that we'd want a function where we can similarly punch in > a PMD/PUD > and have it do the same thing as well, instead of special-casing > ptes. Looking at the differences between the pte and pmd code, there is another big thing that stands out. The pte code will call mark_folio_dirty() when needed, but the pmd and pud code do not. For hugetlbfs we can get away with that, but for huge folios coming from a filesystem, don't we want to call mark_folio_dirty() somewhere? I'm happy to do whatever cleanups we can do to this code while we're here. --=20 All Rights Reversed.