From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f202.google.com (mail-dy1-f202.google.com [74.125.82.202]) (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 821313559FC for ; Wed, 14 Jan 2026 20:53:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768423988; cv=none; b=ngSIOO39IiLBaIH90eI9Xr+wFRU4Z3LUhg+PH9K+MpJCR7JaO+gfh5F2uqsCpQuDubuuyhkBH4pIIDbWssrpLI4pPxC0V2YQ/wyXNj54wm5xp9PPEcz6AjTuuPzDyRX2tFHC4qFmQnyJItb3BalHXfn7lwHH8wjwSy5lIde0dJg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768423988; c=relaxed/simple; bh=TtCLXs2pTBtJPCxHUMI6r5ZGmhBpGezHH5+nvl+813M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uTkxr43AuknN5Ksri8PhlPbLTXyR7vONATb7SfkSs8fimb1N5M8n7zTLkXXuVE7j34PP0uVehkRQzy1DyELFjha3dhKW4PzwxOBTNBQ8rpZZlOx/95J+aH6ZtUlFMiHmSCCcJnpEx3aKt6XIkZ9OuLE/vIh92RsPuVbnLLVbEGA= 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=aZTsLmkD; arc=none smtp.client-ip=74.125.82.202 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="aZTsLmkD" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-2b0530846d3so396945eec.0 for ; Wed, 14 Jan 2026 12:53:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1768423986; x=1769028786; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=s3bxOGWS6glvYwDy8bUAmdDe2eUabDyr0vbAJE9zJUk=; b=aZTsLmkDVv57wIi0wDC6HQMj+tlDTufeWr/USaEmMBFFxAl6Ps2FeXllpIanh+nRR2 tO4osh15uu/gXT5g9Ls2Pa3NnxhWNLjkUMd5g+XUPTwpo5iRBF1s4St80KcmiVi6JQ0R 81scpdmxNjT5hZodvXFhavdLlXIOB/usz60LQnk/aI7thVjZUXQw8rjjSL2CyEDeiz+/ puHnx7wGbfoR3mSTkp4WSnVBFc6tcRVVwZi+pzvSQPv4pl7v6pO+1qpHfkd0h8O4xeVZ xGRLbeoI5vFo5sH7gXFg/vh8ZaQjHnMavkrwSuAEnE0xleU/sibCXjCv56ysssLHkqpM ukoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768423986; x=1769028786; h=content-transfer-encoding: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=s3bxOGWS6glvYwDy8bUAmdDe2eUabDyr0vbAJE9zJUk=; b=EfjaOmN8G3oM8hn3XwUvzBs/pSRREoyr5osQ67IFwNYXM3uPS4D6qrFyr8Mfbj3K39 9zLtMIOy6bds687xuOokYbQetNq9aAmdTHsyC72UI797FlAHXiWEoLPfT+C/kIpNp1cf 5D5hzegx4xY2tjRAm6jMYNxHvvA1U1gXzdMPoD+khFcAyCSXXYh0GzgQynz7SVrxZ1jC Ik97JKYHPV1XhKSe6nrKQPBM+YAvTbPdauF+g23yEsi4zqGiJ40BbOFHi5lflMC53A6C 3x57g+/DfOEMnZrioA2B0XCwYdLBdQEM6oXOxZLuB5uptSajMlgf8kwhw0Y4W3myiZwT 2RpA== X-Forwarded-Encrypted: i=1; AJvYcCW5ERrHiw/sR8/epsNzeua/xdy7O9DhSrlvF+e4OurBDLx3Jqz0V0iD2BXW35NCxiSof+QQD2QdSvowbWw=@vger.kernel.org X-Gm-Message-State: AOJu0YxMyLUCSRXDoy8+GB4ie2aRoC+MXFV0/qt3scSRCL3NeeIwl1O1 9xqOiE4qcqgAfxxv705gXliutTaSxeNmeaSaKHM/yAhy1c8lRrcrmlic8jqgfgcLtREf4o7QoWl m+2JP6C0WN3vTSg== X-Received: from dlbcy2.prod.google.com ([2002:a05:7022:b82:b0:119:9f33:34a6]) (user=bingjiao job=prod-delivery.src-stubby-dispatcher) by 2002:a05:701b:2206:b0:119:fb9c:4ebb with SMTP id a92af1059eb24-12336a67917mr2995405c88.30.1768423986476; Wed, 14 Jan 2026 12:53:06 -0800 (PST) Date: Wed, 14 Jan 2026 20:53:01 +0000 In-Reply-To: <20260114070053.2446770-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: <20260114070053.2446770-1-bingjiao@google.com> X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog Message-ID: <20260114205305.2869796-1-bingjiao@google.com> Subject: [PATCH v9 0/2] mm/vmscan: fix demotion targets checks in reclaim/demotion 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 , muchun.song@linux.dev, roman.gushchin@linux.dev, tj@kernel.org, longman@redhat.com, chenridong@huaweicloud.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This patch series addresses two issues in demote_folio_list(), can_demote(), and next_demotion_node() in reclaim/demotion. 1. demote_folio_list() and can_demote() do not correctly check demotion target against cpuset.mems_effective, which will cause (a) pages are demoted to not-allowed nodes and (b) pages are failed to demote even if the system still have allowed demotion nodes. Patch 1 fixes this bug by update cpuset_node_allowed() and mem_cgroup_node_allowed() to return effective_mems, allowing directly logic-and operation against demotion targets. 2. next_demotion_node() returns a preferred demotion target, but it does check the node against allowed nodes. Patch 2 ensures that next_demotion_node() filters against the allowed node mask and selects the closest demotion target to the source node. =3D=3D=3D Hi Andrew, Sorry for the extra noise in your inbox. I=E2=80=99m resubmitting the full refreshed patch series together this time= . I just realized it is better to include the unmodified patches alongside the modified ones to ensure compatibility with upstream automated tools and to simplify your review process. The refreshed patch series replaces some commits in mm-untable, including: - Commit 809cc3db1831 ("mm/vmscan: fix demotion targets checks in reclaim/demotion") - Commit fd8cb9a8cedc ("mm/vmscan: select the closest preferred node in demote_folio_list()") - Commit 127714c76c46 ("mm/vmscan: fix uninitialized variable in demote_folio_list()") Thanks! Best regards, Bing Bing Jiao (2): mm/vmscan: fix demotion targets checks in reclaim/demotion mm/vmscan: select the closest perferred node in demote_folio_list() include/linux/cpuset.h | 6 ++-- include/linux/memcontrol.h | 6 ++-- include/linux/memory-tiers.h | 6 ++-- kernel/cgroup/cpuset.c | 54 ++++++++++++++++++++++++------------ mm/memcontrol.c | 16 +++++++++-- mm/memory-tiers.c | 21 ++++++++++---- mm/vmscan.c | 31 +++++++++++++-------- 7 files changed, 95 insertions(+), 45 deletions(-) -- 2.52.0.457.g6b5491de43-goog