From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f74.google.com (mail-dl1-f74.google.com [74.125.82.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E3BD36E46B for ; Wed, 14 Jan 2026 07:01:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768374077; cv=none; b=o3IRZE3qLJY9QH3cz8w6ke8CO/G0DbJusSdLO6R+uoxpzz6xoNvE+ChNpOch7xW/DkbM/cr0lsRqfnqAkLyBidUsVErwtBLv3FZQ9aZBqomHgQDYXaVDGYxXe1IjB91j1tJVvLFEIai8HdAfSdif73QidhiUIhcQpXBUthacGvY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768374077; c=relaxed/simple; bh=Rq0v3Gst8cR2wOesmrG/htLYOaprH+mKuGbVTU+59Uc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qI4NtvwfpoFaz6VIPslh1U9TqGtVR+YS27bbSnFjvkuSwdK4vP6Yv99is+X3bWgkQrsNfVF3VhK1niTfJQlblcPEQFNBzaBSopNuoWBI82+nc4XXOa/gkgnczPdHLFDIDq/XtBoelgq8fhSuedQ6v0OUQ2XpVCTbuoKcCbKcFW8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--bingjiao.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=NKZZbBA8; arc=none smtp.client-ip=74.125.82.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--bingjiao.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="NKZZbBA8" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-12338d13f2cso160619c88.1 for ; Tue, 13 Jan 2026 23:00:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1768374055; x=1768978855; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Cyv6P5VtGm/MbLQqPn/8e2BMzUG89IA/lF6ABr1FhIs=; b=NKZZbBA8XcN/bu41R6i7nVqGNB5QrWSAzrOf24GFGC7mt2UEY8mA8CzXDfPQ3RDCIN eneAHxdO5NEgYAToBS+XiOPf48oUc1xCvrRia/MTY48xEeaaIF16daMA/12YJsnmaO7S o5vK6WceDSoiR6BXLXnUrDgVWaZV9Ncw5ox1XT/+YXA7+nBOfeOoi6RFdjUSERAgZbnm Ti9nIWzOWBsJcNNY3ICPI5/xEuX8tSipKHbP5NZJvpb+Y3asSJkILDiDAuo/Gqa6f0++ SZILolh3okiKRnnGSY8XxNsKdMnBhumSpOUf4VGjOUgmHxQ/ovEFJ25E6I0Thtbnw9BL VDGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768374055; x=1768978855; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Cyv6P5VtGm/MbLQqPn/8e2BMzUG89IA/lF6ABr1FhIs=; b=xMM95m4i0QpWZjNowYGMMfZjB6CG8xsbfHPSTEvImDxnSmP5dXOVq1HLlm+v9F2LBk gjQ0WPltT3DQCgzD8m+gaPOePRWzwm9y8fZ6lEcE+JiUpaB+gaPd7shyhvYoDHkWyqC3 5ePw7vWaMA7eXf51nVdHr9un/qEQ6vi0Ho+XKFAxO9UHez43OKZ5s6Zf3r2N+XTrKFbz Mpqsvmrlql6SB2GyyxjYV7huq27lu5NirZ3DLR9sVlVguFXyTxrNGufhdvzgRTwNsK6j LOXrghuxTvYzn/G+gKkB7vivLZQU4Ow0/ojeOGS3dRRb13rGlImiUfTGX/DylxnXQfLr /M1g== X-Forwarded-Encrypted: i=1; AJvYcCXjro5CufV+LrLswLbZim8FQE/K8WkQIrRSPQtZCDc1ZVt73BEZyaCUOFiUhZ49ANXvsQEAUNeUWQ0Uqa4=@vger.kernel.org X-Gm-Message-State: AOJu0YzMSqgHdoVl0pgVT12zeWgr72noKTyb/G7s5hSw8KhVN8IYtAI5 Ii2WZ0xW8Ii/d0AtLwG+chyPqZ2yYvkzD1yknGvTGd24dC1aEbj0CB/39aZPcTAKRmbVwe7j1y7 6HKewvQ7EGdFHOQ== X-Received: from dlbeg14.prod.google.com ([2002:a05:7022:f8e:b0:123:2e41:8b40]) (user=bingjiao job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:3f84:b0:123:3424:eb5b with SMTP id a92af1059eb24-12336a400d8mr1564087c88.18.1768374055383; Tue, 13 Jan 2026 23:00:55 -0800 (PST) Date: Wed, 14 Jan 2026 06:59:48 +0000 In-Reply-To: <20260108033248.2791579-1-bingjiao@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260108033248.2791579-1-bingjiao@google.com> X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog Message-ID: <20260114070053.2446770-1-bingjiao@google.com> Subject: [PATCH v8 0/2] mm/vmscan: select the closest preferred node in demote_folio_list() From: Bing Jiao To: bingjiao@google.com Cc: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , Qi Zheng , Shakeel Butt , Gregory Price , Joshua Hahn , chenridong@huaweicloud.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" [Patch v7 2/2] tries to traverse the demotion targets hierarchically until a preferred node within mems_allowed is found. However, node_demotion[node].preferred may not contain all nodes in the next memory tier. For example, in the below typograph: Top-tier Node 0 ---- Node 1 | | | | Far-tier Node 2 Node 3 node_demotion[0].preferred: [2] node_demotion[1].preferred: [3] node_demotion[2].preferred: [] node_demotion[3].preferred: [] If mems_allowed is [3], demote_folio_list() cannot find a valid demotion target when demoting pages from Node 0. Because next_demotion_node(0) returns Node 2 and [2], which are not in mems_allowed; the second call to next_demotion_node(2) returns NUMA_NO_NODE. This patch uses find_next_best_node() to find the closest node when all preferred nodes are not in mems_allowed, mimicking the logic of establish_demotion_targets(). Hi Andrew, Could you please remove Commit fd8cb9a8cedc ("mm/vmscan: select the closest preferred node in demote_folio_list()") and Commit 127714c76c46 ("mm/vmscan: fix uninitialized variable in demote_folio_list()") from the mm-unstable branch, as this patch serves as a full replacement for both. I suggest allowing some time for this to be thoroughly reviewed in case there are any remaining edge cases or issues I overlooked. Because no modifications to [Patch v7 1/2], I did not attach a new version of it. Thanks! Best regards, Bing Bing Jiao (1): mm/vmscan: select the closest preferred node in demote_folio_list() include/linux/memory-tiers.h | 6 +++--- mm/memory-tiers.c | 11 +++++++---- mm/vmscan.c | 30 +++++++++++++++++++++++------- 3 files changed, 33 insertions(+), 14 deletions(-) -- 2.52.0.457.g6b5491de43-goog