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 6A09643D501 for ; Fri, 31 Jul 2026 18:34:44 +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=1785522886; cv=none; b=r3W4ROYNZpH6WJxJHxvlf0wwBFjBj+5NcMZAmABq+1caflWco2oVGW2Du7R5Vb7b2jYO6vLe6n2Olrnu00vmAD+y0TZh72VhJwYGuA7bnbmIWKBOlj05e0qFB7b+Z0VjUzUj7vdDrLeevWA9xMgvv1ImDr0bZ/UmLgczYllPhG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785522886; c=relaxed/simple; bh=xrDeeylJuieZY5hBqbOAQJHhoSSI5F+J3jqIK/WRh7w=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=NEHVg7I8DKF/ZbPYT+hk+F0Qp0V0QLfkr7/L+b9tpE1oqPBCdn561KmvDJtxcEzyRycKRJDgl8jafilWgjWumqk6Y3SDUK7PgveqFMRQMYJpGtuaKQnWV1NBU5yovaU9WXO1EaNGWI3ps6kJU0ZGpKkSGLnE8vCKyiyPOU/TW40= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (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=BN8J1Wah; arc=none smtp.client-ip=96.67.55.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (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="BN8J1Wah" 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=xrDeeylJuieZY5hBqbOAQJHhoSSI5F+J3jqIK/WRh7w=; b=BN8J1WahJZOavl85ADvcDRCj9T cbOM/qrJY0R+3M3eUyLZAiA/xCqudjerivPytegxduDhpxg5s/7hGqHHOhtlK9A7ppaYQ5uj5EtOI gY7qngrmmkatQHIwH1Vc8JfsE7K4RXiJpNsRJd77J3aLz0c8AO8kjZn4FMTce1stw5FYJ5JUmJCVj Jbg2aHzcByN9r+aa6Q4a1DkwLWIX6L77lNATO1vRYIe8CVFZeNKXXjnG9ZyN3gMVa6Tg1Ggh8NYak NY1z81VMnNwwTBkWAyjfYGI5ItQPa/9tqm2prJV39I1NW5Pg9l0YoXIkXjST7fCFaKiJNnQgggwSG ROOYRefA==; Received: from [96.67.55.146] by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1wps3w-000000002Tu-3LfS; Fri, 31 Jul 2026 14:34:28 -0400 Message-ID: Subject: Re: [PATCH RFC] mm/gup: batch contiguous pages in follow_page_mask() and return them via a pages array From: Rik van Riel To: "Lorenzo Stoakes (ARM)" Cc: David Hildenbrand , Andrew Morton , Jason Gunthorpe , Peter Xu , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, Aristeu Rozanski Date: Fri, 31 Jul 2026 14:32:58 -0400 In-Reply-To: References: <20260730035350.1fc95dd8@fangorn> Autocrypt: addr=ri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p09vsAV2DwdqS69x9RPbvE/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.56.2 (3.56.2-2.fc42) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2026-07-31 at 13:33 +0100, Lorenzo Stoakes (ARM) wrote: > > =C2=A0mm/gup.c | 539 +++++++++++++++++++++++++++++++++-----------------= - > > ---- >=20 > OK it seems the message isn't really getting through... >=20 > You really have to spend at least some time filtering this LLM- > generated > stuff. >=20 I spent a fair amount of time cleaning up the code and comments. Arguably the new code is cleaner than the old code was. However, I do agree this patch is too big. That won't happen again. > Nobody's got time for walls of text and giant changes like this. >=20 I had no idea how to split it up when I made it,=C2=A0 but have found a few ways now. I've split up the patch into a series of 5 now: 1) mm/gup: convert follow_page_mask() to return a long 2) mm/gup: split follow_page_pte_commit() out of follow_page_pte() 3) mm/gup: add gup_fill_pages() and use it 4) mm/gup: return a huge page's full count from follow_page_mask() 5) mm/gup: walk multiple PTEs per follow_page_pte() call The changelogs naturally got shorter with things split up this way. > And at least use a reasonable model - sonnet isn't intended for > kernel > development is it? >=20 Sonnet 5 seems to be about on par with Opus 4.7 from last year. The difference is not that dramatic. Also, I have found that while Opus tends to make fewer=C2=A0 mistakes than Sonnet, they both produce unreadable LLM=C2=A0 output when left alone. In order for them to produce code that is at least a good starting point for editing, they need to follow rules. Once you apply the rules, Opus and Sonnet do not produce results that are all that different from each other. I just added a few new rules, so the tooling won't even let me create too-large patches any more. Whenever you see me, or somebody else, produce something wrong, either with or without an LLM, please yell at me, so I can add the proper rules to kernel-style (creation side), or review-prompts=C2=A0 (review side), so those things get caught=C2=A0 automatically in the future, and not sent to the list. --=20 All Rights Reversed.