From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795998281; b=IqZU5qaeFG1TYdHhtiWhxArdC0e7BS67/TzW0V4lO2ORgZaxjVhZPKOOooVjF1J+6PF6 4JuuhChPradGbZ7kXrPNfh9RVV9cMBL7AioROf3+7i2UKQsv8B7d5qJtDHoeC1I3SMFRS tvVZc74o4/A0OxwJH1OfJuY3okM73Mn3NDD/uzOtcj9uOBOoRkPnL8ZpWiP2mtPcNumMr DKeE6BN6FbBm/3RkTzUhPhx5qWOA7xTC8o0u+WFN2N/HW+9d8QcXxzXv2F6OK9TyPFh30 Iva9fE+DwgGHJ96zjRsZSJ1G9wwSiTk5cpq/4mPWV8aZn9A2niOgFwOwHfYx6ze20BQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795998281; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Ux/Wqe8UchsX/PhWcw7tdXZRndxMBKHrzh6LwRkGTaE=; b=vr8NABHkLhNAL69r0hsfu0xKw2KfQmg+WS5DoyMCs7PSgAPDcoaWxCNoe81Bn22VuaeT Mgks9pRANr+aWbIoOO08/9SoH8pFr3bGp0m7Sgh4V2mHumBGKD3ujnw/dF7eULS1zZUW5 t30dMQmw5fs6Q2WokhkwB1LDYHt7Fl3kfdo5tHMDwh2cz6GZzZx/bg3Dzv0ROaHm3KTvv P9SmjtuVe9Fp6o2ERoxEX5ua3QWE1b0KXAxQHdDT0CcUE5IJHRgBvKKdn2VOZhX3j2Bzk LOJqIET/7rrgt/Kx+6PpEQNcBnzQhFjx8BS+YYbvr4fFR0KVokA0aaAvamKbi3RtI9A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IQYF8ebj; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1568606A31C for ; Mon, 30 Nov 2026 00:24:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IQYF8ebj Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C7021F00896; Mon, 30 Nov 2026 00:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795998281; bh=Ux/Wqe8UchsX/PhWcw7tdXZRndxMBKHrzh6LwRkGTaE=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=IQYF8ebjN9yYreC+6CLAs5hPXZ5618bRjrbp+/L0V6jBvTav4QSbJ9RotLtYh32vi dpFcamzKrBvAtKYl5DtMeu2PdgPm8qMhlBI7MhwwvbJoaYFg59qVWqFFoAOjTJx9rA xiTHz6GhjpF1IeHfYcZMNEY3+58Xp1dEpdWwVpsTaOeErX4gVYOgUN5iFftGtry6HM ML42UwwEuMeQ0y7zVEuqmBUqIihK1bkiwq2dgatijbiDdX9SDvddm3fruNqDSjOZZ2 klYrSyUUW2wZlgFPgucOsm1HbC11rdkExXzRgfL+zNRvGpNbQnrRwJ9yp1XJatbWrY x50gdWTYC6ECg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: generic/255: read(2) returning ENOMEM on 64k file systems Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?VGhlb2RvcmUgVHMnbw==?= , "Ext4 Developers List" , linux-mm@kvack.org, "Matthew Wilcox" In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 00:24:40 +0000 X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] mm: missing Signed-off-by trailer and informal RFC email commit message - [High] mm: vmscan: bypassing compaction_ready() breaks costly __GFP_RETRY_MAYFAIL - [Low] mm/filemap: missing Fixes trailer for minimum-order folio allocations -- commit 6134b8058c4679c6f6ebfa5d61c0da90b8cc6fdd Author: Theodore Ts'o > generic/255: read(2) returning ENOMEM on 64k file systems > > On systems with a 4k page size, when reading from a file system that > has a 64k block size, every page cache folio has an order of at least > 4, which is above PAGE_ALLOC_COSTLY_ORDER (=3D=3D 3). As a result, any > memory allocation without __GFP_RETRY_MAYFAIL or __GFP_NOFAIL can be > very prone to failure, even when there is gigabytes of memory > available. > > This is causing the xfstests test generic/251 to fail 50-60% of the > time on my test appliance when running the ext4/64k configuration. > It's not clear what the best solution might be. Please note that this > is not ext4 specific. Any file system attempting to use a 64k block > size on a system with 4k blocks could run into this issue. > > The simplest fix which the LLM came up with is the first attached > patch; it causes mm/filemap.c to use __GFP_RETRY_MAYFAIL when needed. > This is not a complete fix, however. The LLM came up with a more > reliable reproducer which fails nearly 100% of the time (25/26 runs), > using __GFP_RETRY_MAYFAIL beings it down to 4% of the time (1/23 > runs)[1]. > > [1] https://github.com/tytso/ext4-artifacts/blob/main/2026-11-xfstests-te= st-fixes/evidence/mm251/findings.md#42-test-results > > Using __GFP_NOFAIL makes it completely reliable (of course), as does > an additional patch which changes direct relcaim to be more aggressive > if __GFP_RETRY_MAYFAIL is passed (the second attached patch, > direct-reclaim.patch). > > I believe the first patch shouldn't be _too_ controversial; but it's > not a complete solution. Is the second patch is the right way to go, > or would some other approach would be better? > > Thanks in advance for suggestions and comments! > > - Ted > > P.S. For more details, you can read (in very exhausting detail) the > report from the LLM[2]. Other xfstests failures that I'm working > through can be found here[3]. > > [2] https://github.com/tytso/ext4-artifacts/blob/main/2026-11-xfstests-te= st-fixes/evidence/mm251/findings.md > [3] https://github.com/tytso/ext4-artifacts/blob/main/2026-11-xfstests-te= st-fixes/xfstests-fixes.md [Severity: High] This commit is missing a Signed-off-by: trailer. In addition, the commit message is written as an informal RFC mailing-list note discussing two separate attached patches rather than a self-contained kernel changelog, and the subject line lacks an mm: prefix while citing generic/255 instead of generic/251. [Severity: Low] For the minimum folio order allocation failure in mm/filemap.c, should this include a Fixes: tag for the commit that started allocating mapping_min_folio_order() folios? Fixes: ab95d23bab22 ("filemap: allocate mapping_min_order folios in the p= age cache") > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 6a1af9b92349f..66b8d1bcc0fd5 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -6680,6 +6680,7 @@ static void shrink_zones(struct zonelist *zonelist,= struct scan_control *sc) > */ > if (IS_ENABLED(CONFIG_COMPACTION) && > sc->order > PAGE_ALLOC_COSTLY_ORDER && > + !(sc->gfp_mask & __GFP_RETRY_MAYFAIL) && > compaction_ready(zone, sc)) { > sc->compaction_ready =3D true; > continue; [Severity: High] Does bypassing compaction_ready() for all costly __GFP_RETRY_MAYFAIL allocations force unconditional node reclaim and prevent compaction from escalating to COMPACT_PRIO_SYNC_FULL when a zone already has plenty of free base pages? In __alloc_pages_slowpath(), the initial compact_first pass only runs COMPACT_PRIO_ASYNC compaction before entering __alloc_pages_direct_reclaim(= ). compaction_ready() checks both whether the high-order watermark is already met and whether free base pages satisfy compaction_suitable() above the high watermark: mm/vmscan.c:compaction_ready() { if (!gfp_compaction_allowed(sc->gfp_mask)) return false; /* Allocation can already succeed, nothing to do */ if (zone_watermark_ok(zone, sc->order, min_wmark_pages(zone), sc->reclaim_idx, 0)) return true; ... watermark =3D high_wmark_pages(zone); if (compaction_suitable(zone, sc->order, watermark, sc->reclaim_idx)) return true; return false; } With compaction_ready() skipped, shrink_zones() unconditionally calls shrink_node() on every node in the zonelist even when gigabytes of free order-0..3 pages are already available for synchronous compaction. Under MGLRU, shrink_node() does not call should_continue_reclaim() and keeps reclaiming until sc->nr_reclaimed reaches max(sc->nr_to_reclaim, compact_gap(sc->order)). Worse, if a zone has abundant free base pages for compaction but no unprotected reclaimable LRU pages (for example, memory is already free in lower orders or protected by memory.low), sc->compaction_ready remains false and do_try_to_free_pages() cannot return 1 via its sc->compaction_ready check. Instead, direct reclaim scans all priorities down to 0, throttles in VMSCAN_THROTTLE_NOPROGRESS, triggers the force_deactivate and memcg_low_reclaim retry passes (breaching cgroup memory.low protection), and returns 0. A zero return from __perform_reclaim() causes __alloc_pages_direct_reclaim() to skip drain_all_pages() and causes __alloc_pages_slowpath() to skip should_compact_retry(), so compaction never escalates to COMPACT_PRIO_SYNC_FULL. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/awsvBJeU3SGSdklm@mi= t.edu?part=3D1