* Re: [PATCH v2] mm/memory-tiers: reset demotion targets of nodes without memory
2026-10-21 2:44 [PATCH v2] mm/memory-tiers: reset demotion targets of nodes without memory Gregory Price (Meta)
@ 2026-10-21 2:46 ` Zi Yan
2026-11-12 9:37 ` David Hildenbrand
2026-11-24 20:00 ` [merged mm/core.git: for-next] mm-memory-tiers-reset-demotion-targets-of-nodes-without-memory.patch removed from -mm tree Andrew Morton
2 siblings, 0 replies; 4+ messages in thread
From: Zi Yan @ 2026-10-21 2:46 UTC (permalink / raw)
To: Gregory Price (Meta)
Cc: linux-mm, linux-kernel, kernel-team, akpm, david, joshua.hahnjy,
rakie.kim, ying.huang, weixugc, aneesh.kumar
On 20 Oct 2026, at 22:44, Gregory Price (Meta) wrote:
> When a node loses its last memory, offline_pages() clears N_MEMORY
> before the memory-tier callback rebuilds the demotion targets.
> disable_all_demotion_targets() resets only N_MEMORY nodes, so the node
> keeps its old node_demotion[] entry while it has no memory. Before
> 6c542ab75714, the reset covered every online node.
>
> A reclaimer reads the stale entry only between the node regaining memory
> and its targets being rebuilt, and it filters the entry against the
> current allowed targets, so there is no user-visible effect. To see it,
> online and then offline a node's only DIMM: a debugger still finds the
> lower-tier node in node_demotion[nid].preferred.
>
> Reset the targets of every node.
>
> Fixes: 6c542ab75714 ("mm/demotion: build demotion targets based on explicit memory tiers")
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
> ---
> v2: +comment
>
> mm/memory-tiers.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
LGTM. Thanks.
Reviewed-by: Zi Yan <ziy@nvidia.com>
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] mm/memory-tiers: reset demotion targets of nodes without memory
2026-10-21 2:44 [PATCH v2] mm/memory-tiers: reset demotion targets of nodes without memory Gregory Price (Meta)
2026-10-21 2:46 ` Zi Yan
@ 2026-11-12 9:37 ` David Hildenbrand
2026-11-24 20:00 ` [merged mm/core.git: for-next] mm-memory-tiers-reset-demotion-targets-of-nodes-without-memory.patch removed from -mm tree Andrew Morton
2 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2026-11-12 9:37 UTC (permalink / raw)
To: linux-mm, Gregory Price (Meta)
Cc: linux-kernel, kernel-team, akpm, david, ziy, joshua.hahnjy,
rakie.kim, ying.huang, weixugc, aneesh.kumar
On Tue, 20 Oct 2026 22:44:38 -0400, Gregory Price (Meta) wrote:
> When a node loses its last memory, offline_pages() clears N_MEMORY
> before the memory-tier callback rebuilds the demotion targets.
> disable_all_demotion_targets() resets only N_MEMORY nodes, so the node
> keeps its old node_demotion[] entry while it has no memory. Before
> 6c542ab75714, the reset covered every online node.
>
> A reclaimer reads the stale entry only between the node regaining memory
> and its targets being rebuilt, and it filters the entry against the
> current allowed targets, so there is no user-visible effect. To see it,
> online and then offline a node's only DIMM: a debugger still finds the
> lower-tier node in node_demotion[nid].preferred.
>
> [...]
Applied, thanks!
tree: mm/core.git
branch: migrate-7.5.misc
Applied patches will appear soon in mm-next, followed by linux-next.
Please report any outstanding bugs that were missed during review, so we
can either drop the patch series or decide how to fix it up.
It is encouraged to provide Acked-bys, Reviewed-bys, and Tested-bys even
though the patches have already been applied. If possible, patch trailers
will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. Further, this is not a guarantee that the
patches will go upstream. If in doubt, please check the listed branch.
[1/1] mm/memory-tiers: reset demotion targets of nodes without memory
https://git.kernel.org/mm/core/c/12566c5b
--
Cheers,
David
^ permalink raw reply [flat|nested] 4+ messages in thread* [merged mm/core.git: for-next] mm-memory-tiers-reset-demotion-targets-of-nodes-without-memory.patch removed from -mm tree
2026-10-21 2:44 [PATCH v2] mm/memory-tiers: reset demotion targets of nodes without memory Gregory Price (Meta)
2026-10-21 2:46 ` Zi Yan
2026-11-12 9:37 ` David Hildenbrand
@ 2026-11-24 20:00 ` Andrew Morton
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2026-11-24 20:00 UTC (permalink / raw)
To: mm-commits, ziy, ying.huang, weixugc, rakie.kim, joshua.hahnjy,
david, aneesh.kumar, gourry, akpm
The quilt patch titled
Subject: mm/memory-tiers: reset demotion targets of nodes without memory
has been removed from the -mm tree. Its filename was
mm-memory-tiers-reset-demotion-targets-of-nodes-without-memory.patch
This patch was dropped because it was merged into mm/core.git: for-next
------------------------------------------------------
From: "Gregory Price (Meta)" <gourry@gourry.net>
Subject: mm/memory-tiers: reset demotion targets of nodes without memory
Date: Tue, 20 Oct 2026 22:44:38 -0400
When a node loses its last memory, offline_pages() clears N_MEMORY before
the memory-tier callback rebuilds the demotion targets.
disable_all_demotion_targets() resets only N_MEMORY nodes, so the node
keeps its old node_demotion[] entry while it has no memory. Before
6c542ab75714, the reset covered every online node.
A reclaimer reads the stale entry only between the node regaining memory
and its targets being rebuilt, and it filters the entry against the
current allowed targets, so there is no user-visible effect. To see it,
online and then offline a node's only DIMM: a debugger still finds the
lower-tier node in node_demotion[nid].preferred.
Reset the targets of every node.
Link: https://patch.msgid.link/20261021024438.1942502-1-gourry@gourry.net
Fixes: 6c542ab75714 ("mm/demotion: build demotion targets based on explicit memory tiers")
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Ying Huang <ying.huang@linux.alibaba.com>
Cc: Wei Xu <weixugc@google.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
mm/memory-tiers.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/mm/memory-tiers.c~mm-memory-tiers-reset-demotion-targets-of-nodes-without-memory
+++ a/mm/memory-tiers.c
@@ -378,7 +378,11 @@ static void disable_all_demotion_targets
struct memory_tier *memtier;
int node;
- for_each_node_state(node, N_MEMORY) {
+ /*
+ * When the NODE_REMOVED_LAST_MEMORY event fires, N_MEMORY has already
+ * been dropped from the node, so we must walk every node instead.
+ */
+ for_each_node(node) {
node_demotion[node].preferred = NODE_MASK_NONE;
/*
* We are holding memory_tier_lock, it is safe
_
Patches currently in -mm which might be from gourry@gourry.net are
mm-mempolicy-convert-mempolicy-refcnt-to-refcount_t.patch
selftests-mm-add-madv_cold-and-madv_pageout-contract-tests.patch
selftests-mm-check-madv_cold-and-madv_pageout-range-handling.patch
selftests-mm-check-that-madv_cold-and-madv_pageout-reject-hugetlb.patch
selftests-mm-check-that-madv_cold-and-madv_pageout-preserve-shared-memory.patch
selftests-mm-check-madv_cold-and-madv_pageout-on-partly-advised-thps.patch
selftests-mm-check-madv_pageout-file-permissions.patch
selftests-mm-check-that-unauthorized-madv_pageout-skips-large-file-folios.patch
mm-hmm-reject-shadow-stack-mappings.patch
^ permalink raw reply [flat|nested] 4+ messages in thread