summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linux.alibaba.com>2026-03-06 09:43:39 +0300
committerAndrew Morton <akpm@linux-foundation.org>2026-04-05 23:53:15 +0300
commit83ec1286b173e6ff54d0dd0291fbc517d65a8d5b (patch)
tree5f09b566a7597a3d8ceaf69b0d097d6d133d3b37
parent37fb436ff673f33e1ecd2d6f771fd789ed2a6092 (diff)
downloadlinux-83ec1286b173e6ff54d0dd0291fbc517d65a8d5b.tar.xz
mm: rmap: add a ZONE_DEVICE folio warning in folio_referenced()
The folio_referenced() is used to test whether a folio was referenced during reclaim. Moreover, ZONE_DEVICE folios are controlled by their device driver, have a lifetime tied to that driver, and are never placed on the LRU list. That means we should never try to reclaim ZONE_DEVICE folios, so add a warning to catch this unexpected behavior in folio_referenced() to avoid confusion, as discussed in the previous thread[1]. [1] https://lore.kernel.org/all/16fb7985-ec0f-4b56-91e7-404c5114f899@kernel.org/ Link: https://lkml.kernel.org/r/64d6fb2a33f7101e1d4aca2c9052e0758b76d492.1772778858.git.baolin.wang@linux.alibaba.com Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com> Reviewed-by: Alistair Popple <apopple@nvidia.com> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: Barry Song <baohua@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Dev Jain <dev.jain@arm.com> Cc: Jann Horn <jannh@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Liam Howlett <liam.howlett@oracle.com> Cc: Lorenzo Stoakes (Oracle) <ljs@kernel.org> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Qi Zheng <zhengqi.arch@bytedance.com> Cc: Rik van Riel <riel@surriel.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Shakeel Butt <shakeel.butt@linux.dev> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Wei Xu <weixugc@google.com> Cc: Will Deacon <will@kernel.org> Cc: Yuanchu Xie <yuanchu@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/rmap.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/rmap.c b/mm/rmap.c
index 5fd22ba59d35..cd48f34f11b5 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1072,6 +1072,7 @@ int folio_referenced(struct folio *folio, int is_locked,
.invalid_vma = invalid_folio_referenced_vma,
};
+ VM_WARN_ON_ONCE_FOLIO(folio_is_zone_device(folio), folio);
*vm_flags = 0;
if (!pra.mapcount)
return 0;