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=1796389957; b=oUUeMme6zx6RrknArDQSPvhCmgrp4Ad0B1Lf2rq9yTmtVcM9u5HNKSO4f0kUUu+fH5bd nO7PfU5WtCIgStQNzZkdVFY24Qa+2aIfkiuFyEF/VcL7bhFu+rtFbOHP0zouzpuhkpj8q F3x5DkGxD3ntdsw8g2mHYhQsU1/Nx+Vc0CyVYr+pureXpu6CWali84+JyP9uBO/WxAd5M 9Gub3rtdx6wdTg/ILydVXRysaAvgndmCVl3l9IcwiQT77wLwrgD5u29Hn4Y8x8VEa3+Da YRVDfJNgf8jza7dP3e0hqwSoLyBbJ2VhK+rVF0YoMstl1b8mkljXoz1CnTEiUHmz+Mw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389957; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=k25L8MeFmrutFXizuhkt6gnrpLU94U7k2xye3O6/GiI=; b=e/99ZInRuUXJQSYYYUgw+pqzwfZa2Q4DhHX2bgT5ORxCGN253gnUPW4L1/WaTK5PnPYp NIXzYLFLRBM0aTUURPz+5CDcaZxRTIFyjzyfHx+7VmrOd4oHX3KuEfRn88URZLwVQAmDn 0+A6r0yVCbGmTvl7df3TAIzTnYl6FBwf2zWbdvI5qTxthUfGGFnPQtYdhM7Piwa1oUc6E RMROGfVr4P44Ndp98wgIan0eHAczLpjtvQd2XLp4fVw0U85Y8nwi35xW8zAggTzCDgSOk 5HtW8g7zSgx6C8UptfUfsLxalOEJH7yupWRy6lG8eZ9JI2JSxqSfs/9MCxNKBdZH0EQ== 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="S/YQrz74"; 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)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 038EA606A322; Fri, 4 Dec 2026 13:12:36 +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=S/YQrz74 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D74D1F00A09; Fri, 4 Dec 2026 13:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796389956; bh=k25L8MeFmrutFXizuhkt6gnrpLU94U7k2xye3O6/GiI=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=S/YQrz74n+fNIVryevuhRhugAkWl/YPU/aEdBznTB9jsF2CMvOvLAUDYOTzD9Svpy mPOYtlAkq+YzePP+cUSF+LfGhBpkH1KM2T1mDplb2ZEO7wlJRFGTWSrdJQKOoW1E5V 1aZ0G5T1Z40cprZqX4qcZmy3Euw84pMqRtqHjQ/8+UHZAjcCWW59MXC7+EG3ib3JWw ocsoH6Zts69OkXef6haVPrOr7HvMKoja0cGmdWC70DPSHOeLj5JaP8ZxBe+DWA3RQf c0/KjkOhu7nyUajc6rc22s7Rf3IqqNPY7fSE3WVCS0qv+iZ6IFG9Qt51vs/4WvGCZC v9uZSxTOWRogA== Date: Fri, 4 Dec 2026 13:12:34 +0000 From: Harry Yoo To: "Kiryl Shutsemau (Meta)" Cc: Salvatore Dipietro , linux-kernel@vger.kernel.org, hch@infradead.org, abuehaze@amazon.com, akpm@linux-foundation.org, alisaidi@amazon.com, blakgeof@amazon.com, brauner@kernel.org, dgc@kernel.org, dipietro.salvatore@gmail.com, djwong@kernel.org, hannes@cmpxchg.org, jackmanb@google.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, mhocko@suse.com, ritesh.list@gmail.com, rvvandan@amazon.com, stable@vger.kernel.org, surenb@google.com, vbabka@kernel.org, willy@infradead.org, ziy@nvidia.com, David Hildenbrand , Christoph Hellwig , Dmitry Ilvokhin , Brendan Jackman , usama.arif@linux.dev Subject: Re: [PATCH v6] mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations Message-ID: References: <20261001082152.2879289-1-dipiets@amazon.it> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Dec 03, 2026 at 02:05:24PM -0800, Kiryl Shutsemau (Meta) wrote: > On Mon, Nov 30, 2026 at 01:27:02PM +0000, Harry Yoo wrote: > > > @@ -4802,6 +4802,18 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, > > > bool can_retry_reserves = true; > > > unsigned long alloc_start_time = jiffies; > > > > > > + /* > > > + * Costly __GFP_NORETRY callers have a cheap fallback, so don't stall > > > + * them in reclaim or compaction. __GFP_THISNODE callers are exempt. > > > + */ > > > + if (costly_order && (gfp_mask & __GFP_NORETRY) && > > > + !(gfp_mask & __GFP_THISNODE)) > > > + gfp_mask &= ~__GFP_DIRECT_RECLAIM; > > > > Does this apply when the order is not costly but reclaim_compact_order > > is promoted to a costly order by defrag_mode? > > No, the check uses the request order and the promotion happens later. > > I think the question is whether, under defrag_mode, a __GFP_NORETRY > request whose reclaim and compaction get promoted to pageblock_order > should skip direct reclaim like a costly one does. Yes, that's what I meant. Thanks. > Such a request of order 1-3 currently compacts at pageblock_order, > reclaims at pageblock_order and compacts again, then fails without > dropping ALLOC_NOFRAGMENT. which should be avoided given the purpose of this patch. > Buffered writes to a block device look like they hit this: the bdev > mapping is GFP_USER, so its large folios are unmovable, and > __filemap_get_folio_mpol() steps down through orders 3, 2 and 1 with > __GFP_NORETRY. With this patch the costly orders fail fast, but each of > the three small ones still pays for a pageblock_order pass. Sounds like we'd need a follow-up for this? What do you think, Salvatore? -- Cheers, Harry / Hyeonggon