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=1796424365; b=DBBUk5TL9li0eCq90alu8fr/dok0QNyLMckPstys46uSL/ukbshTC7BXPeeDY0SKq2vR WQwcjyBSEG4Q2Ta//oikf01wPUhkpbUqz8z7cjZU6odUTEspTt3bmy669AJz0rbzRv8VV +yUvBKoLEujjnR6F6EIKLZjEy4COnJTdhEZdFWSU/sFzrfip/5OWiy3QnCYvzIGTtaog9 Q3oD2acFcYM2xRdeuD9c934M/ieVHQI9pckOJmbg84RVEcVilgHqFyKGPvevk4Hs7PPRB ADW2i+AgxQNFvttAt7zH4O32vlA34xb1FVOFFaZ3gi7EHjfJlgImHJT49spkUIyhdgQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796424365; h=Received:DKIM-Signature:Received:Received:X-ME-Sender:X-ME-Received: X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=VzWTrrH5rqQlTz2ei7QGlbz6QW1AZbXnFH36NbTM3PY=; b=shh+CR+qe9uJEzdWXFsKr2kaYKddu7bzXj411w0w83cMtGdebJE1JPo/9ZFV1Yw+0zdT kXjI36JaBJaf4RpkP38HVT9aRb0HenwZyEfk4ddVVmnXUJ13HyB947mckVC+xIophmMA5 ypu48GKSOT/ZDdx5d1/DYHMLykl76uLLfYMlVtMfxpthZFL5PLMx1Nw2aErHhC9sU6DWo XEVOHX8IuOCoEW+qZfTtb5CzijBvpXuJ9J0rwdL43GsfDdt2aDEDXXhtz73YDuxYxt8mG hSs7zlJmjqMytueXxk1wy8Vwp6W9rx6KSfcNeX8vEuws+jdrageBfRNZQ/ClnFHOnfQ== 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=XKxIrzEQ; 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 E8E6B606A339; Fri, 4 Dec 2026 22:46:04 +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=XKxIrzEQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id E03471F00936; Fri, 4 Dec 2026 22:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796424364; bh=VzWTrrH5rqQlTz2ei7QGlbz6QW1AZbXnFH36NbTM3PY=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=XKxIrzEQsHxkMl0Eh4wFPU+k1imE80f52JJxx08hWnqS8BAAVyVaDNG8M8jtIOALW R3WK+5S/25OUELtRZWT7b0fCAq6j34fQPtGCRVqwVGjXlmH5hq14eoBfB+4CsH8lTo QSy9De11gF2mastGtWfzV9QV8UWve8jMwh0ih8AubAQP7sphghgyQAwJTXqyjmKPrh +9gn774R3qtYGPDDgY4pKvOVA6ewbxXoZhbf9G/9WBHhdolWz07Wgy9blCP7L0Qrdc sHYu+FGGqg+IZZU32CkS/lPZq8uDA62Z4h8K49n5I3EomeM3PV2wUjPIejrMR1GrSF tN/6/+UKYdHyA== Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfauth.ams.internal (Postfix) with ESMTP id 84643198003A; Fri, 4 Dec 2026 17:45:55 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Fri, 04 Dec 2026 17:46:00 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTFC5LXTcv36HxrCZC7SLu2dOeAJJXSH/JcSsE+wpUYvT4pz7QT05FXGZ0qNcwS0U8 h1YI0D08+EqqWDkKPehiYzirh1bcI8Ntj77cEc0kSs3K5dZ57kyh15526tYF7uHEZt2HBL gwMkS3Y2kIxMni5hfQT4M6f3oxfWfR5GwToJoWcDRt+2t71FFw5gEJ/ivTxszkKfMtt+wy XMIFj2l7MP1/hPX1wfQy57GYyI6+EgzVqVFyxemk5tm1Gk9N0yoOKy1SPEaSlc1yvo6z8+ k6HaXYaZGkrc6sFN5nl8hCeFY3U+UOOnT1x9QMdYKS9rLwG6eYJ39lvS/9YqHyBDDgaJH4 +cl3+KimeDMX6t7+clZqvBXqt2Y9HSym1ua0Pz6ej+2NNTKnoXPZctSOpn162W7V4Ln+la Ws3B1STj3fZrH1JJY7n44YIWEU89up2sgDNqz7mcGc08c9SZbVVSWnCgMlau2CFWfyCa41 z/2xJTmFLHGl4rI7AwBhiIisYX8/QaHF9UOLioEXV6pknEYBDULNHqX749SWbXqahWHj3F Cyn5JN4emDgNhQfTvzs5RSCYsFnL6uNX3ijKdNEmAmPc+36ky1NOCWC+Hc8iPOMDy5rfhS kdDlL35F4E5/0Sp2GHnYPE4MHbK0b7nU9Y3FCroLBOoS1m2149rauDEhXzUg X-ME-Proxy: Feedback-ID: i10464835:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Dec 2026 17:45:52 -0500 (EST) Date: Fri, 4 Dec 2026 14:45:51 -0800 From: "Kiryl Shutsemau (Meta)" To: Harry Yoo 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: linux-kernel@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 Fri, Dec 04, 2026 at 01:12:34PM +0000, Harry Yoo wrote: > 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. I am not sure. I can see it both ways. The request is not costly, but under defrag_mode the only way to serve it is costly work: reclaim and compaction at pageblock_order. That is what this patch spares costly __GFP_NORETRY requests. On the other hand, non-costly requests are expected to reclaim and compact. If these skip it, block device writes get order-0 folios whenever no free unmovable chunk is around, even when one pass could have made a whole block for them. -- Kiryl Shutsemau / Kirill A. Shutemov