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=1796335537; b=WquTxtACU5obRPDF+Ir0dEZ1EiAaPSTxSYkpmht1Hh8M1HOV36AsuSiT6UA+32W4CF5d gv95fVlncxUnJe2Trc8Xkz5KjwNP08tf69yF6mglOIVP15iUW+Y6g3aX+hwhat4FDO+jE p1vLiNtKw5mEkhCsVu+oFQnWyWhAMsVqCC3ogs97WwtkwfOAEF/V/nuCO2HVTwoz0esfo hPeLxZbMwV3gApCaAAyzGQOSoRnFIznUXfJAuUMEV4kejNch/mvq0BEeY+6jqNf2tMwj6 6M8nUZn9zQT9VvRH3vjs8A8TiEl0W6B7hiVs6273FDKhJIWuLhrbwHhWRDAfpYNHJDA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796335537; 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=CYJosfxzXS/bTPACOb0C7yTpfogRtFIVlC/1sGE/t4Y=; b=D9XNCahbA/vmY+WooEz9oMLKxoxrr/b8OgyEdTUo7uzkv3GkzCiRkLqfB3Iom+GJEpvH SHQH2+yMRbjTfzxrwJBfHAFltXNmnszRRyTEZf6Quwcl5e5AQnGLbt8fy+hD+XJqepFj+ fxXa/Sp2ZV09aDEoO/jGwC/9h3JOkaMQzaJacvJD5q5oLkOJIq+O8qa+s23eO533MWov0 LGySVDXbBY5rqu3nPG5m6mDBHk4iJIP5r4lETi7D7nFSZe1lMMGuG9xA3YIJGT+H3ewMU EJLTuAqCmvc1Q6w2Qh5QXtK6sSxJFwyh22INufwt1vSOVFKTvRNhoKy9Ex/ZVqTF0yA== 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=QNzbSVUz; 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 2ED50606A32F for ; Thu, 3 Dec 2026 22:05: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=QNzbSVUz Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF0EB1F0092B; Thu, 3 Dec 2026 22:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796335536; bh=CYJosfxzXS/bTPACOb0C7yTpfogRtFIVlC/1sGE/t4Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=QNzbSVUza2ivdZmbxmsAbXvcqwrmwR6fgEhhT4+V7dESr8GkEywhOBBdsa6xOPftv 1ZNX36wz+rjaQKgIJW5ock1ELzQQ5i+Znqkrz85jZtu9ejuLCenxCuX/MKMhl7MHRS t7j6Pu3bbKwu2WivGOoSR7gdC9+XTYkWIF1p8ZFrHncYuK5cqatong1pEEvQ8j1N1d ceAIEKttRC6RWt4jmYCbkoAGNFyHRhO2EdKc7R+sV1yRwiBvK/+xagBheuUJZTc8YL hiDRcwhX7Hx00nWwJhK5I3EdsDPPdT0CTbH6gJR0ONodIS1KB/D3g7DdoIVOMtxhod pobZIlONbqzhQ== Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfauth.ams.internal (Postfix) with ESMTP id 77441198003A; Thu, 3 Dec 2026 17:05:28 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 03 Dec 2026 17:05:33 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEE6/L/FrJvnTQI+lqdmizkAo2UYmsbMOPa9Cd5DeGohrQbjq//md289iGoU4lc8b eHuJtnbwee5oztI3eTvnpJpOvYxUf79+8y/23BQQOY6X6R40jopygnK3Lyol3NDUVXVTXU Z+Td9wtipZgO8VnxFU1FrblnZyzQy/5Nwrp5WjYnkDTBmDBk/4freRPKtaCJz+f0K8QEcp t4TAcLd+SxxGTCzzbIh5/7J/DoQcYJk/GQRQJJnxLMOPZ9jFGCwKfRr7pcIWzNt+k6V7Jt PPf3G9neV89cr0HaiyfP5Guf3fUnKTDXkJwv4xOlMDKMpgqd7kicwJzquO0738Y8e+pGSA n/s4WecRcYMBbqGuGV6VvxRwYpljkqQnzxIFQCwQd5rfjV1Cwi4xOd1v/sHKan9wHgAio3 2Pc+IY2vNC7RMJ+iH6nfXd2tfM+XGB6gi1GEVHs/WzS8EVFsAbZqUEtjAOCV/WiO+d11hL O2uHb73K1hbx9Pomc88c8b4gxPnbfk138F0fRLxSz86lwbDSidH4wIMUJfGVsWSJpBgUZn xCUxZYQiLgfvxHAIXQKGjJCBhdnqXqxp8G3axtuCUVWCiiN5ZIGOR1FJ3mXpNxBPArwvMS +95E5LMMViSA9YetQ8Qyo2Wkgx9+kv1J3j3ikBJvXqp945uP9iCfdI5RZDrA X-ME-Proxy: Feedback-ID: i10464835:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 3 Dec 2026 17:05:25 -0500 (EST) Date: Thu, 3 Dec 2026 14:05:24 -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 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. 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. 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. -- Kiryl Shutsemau / Kirill A. Shutemov