From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A33B3339709 for ; Wed, 7 Jan 2026 17:39:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767807598; cv=none; b=b2y1aX1lstKpsqVerjfXj4Fl5qCL2qTdHph6mo4fqZ9nErwEzLmLHznjzdzqKtCTxIjrlTWGZqwIIPQVulChOJsH/pdQX93AlFjmKF/tg6WSwmCXXwBTh7zQaQ4e3T8oZf6QSJ2O76v3mMKktvfkyOyvsQUNm7+RT30kVqZfXNQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767807598; c=relaxed/simple; bh=KfZfyEEKCtvxRu8W+wSUsbS3mWH7oGtOON/vMZdQN8E=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=cfePhRWl4vK1yflTf4HNprT+wYXawxyax2DX9M5Uar6f/dcoEKl6KmYNbmPl/4wk0P5xD8O06lKHPkBrivf9vaAMr1HonhXOCxje2vFZZ/b5LlzKFy5suNWD8IAs5Xg4KPMWZyFEYKpbgG0ea3o/TAr4+Pp9rg2iPiKv5/VN6Vo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=2f1K5OSJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="2f1K5OSJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C69E4C4CEF1; Wed, 7 Jan 2026 17:39:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1767807598; bh=KfZfyEEKCtvxRu8W+wSUsbS3mWH7oGtOON/vMZdQN8E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=2f1K5OSJ8sn6yhAq/jUikcdALozL58hSRuhKS6YhXnZxESpg5BnmOITledFhtNxLi jhhZEzXiXcqusBfoa8EwPYZ+3tE3b18u8sqltR9sGn2DvJA4ltXogkIpYgEGBhGUst YSzZJ601r0oWZgSSJmuRTZ9Cff2p1C/bg9lihCrU= Date: Wed, 7 Jan 2026 09:39:57 -0800 From: Andrew Morton To: Bing Jiao Cc: linux-mm@kvack.org, Johannes Weiner , David Hildenbrand , Michal Hocko , Qi Zheng , Shakeel Butt , Lorenzo Stoakes , Axel Rasmussen , Yuanchu Xie , Wei Xu , linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 0/2] mm/vmscan: optimize preferred target demotion node selection Message-Id: <20260107093957.12f7417670241f270783e2d1@linux-foundation.org> In-Reply-To: <20260107072814.2324646-1-bingjiao@google.com> References: <20260107072814.2324646-1-bingjiao@google.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 7 Jan 2026 07:28:12 +0000 Bing Jiao wrote: > In tiered memory systems, the demotion aims to move cold folios to the > far-tier nodes. To maintain system performance, the demotion target > should ideally be the node with the shortest NUMA distance from the > source node. > > However, the current implementation has two suboptimal behaviors: > > 1. Unbalanced Fallback: When the primary preferred demotion node is full, > the allocator falls back to other nodes in a way that often skews > toward zones that closer to the primary preferred node rather than > distributing the load evenly across fallback nodes. > > 2. Suboptimal Target Selection: demote_folio_list() randomly select > a preferred node from the allowed mask, potentially selecting > a very distant node. > > This series optimizes the selection logic while ensuring balanced > allocation across fallback nodes. > > Patch 1/2 introduces a randomized fallback mechanism in > alloc_demote_folio() to prevent allocation hotspots when the preferred > node is under memory pressure. > > Patch 2/2 updates demote_folio_list() to traverse the demotion targets > hierarchically, ensuring the perferred target is always the closest > available node. Yes, those things sound rather suboptimal. Do you have any data which will help us understand the performance benefit of these changes? (2/2 has a typo in the subject and in the comment. perferred->preferred)