Re: [PATCH 23/60] mm/damon: restrict DAMON-native folio operations to common memory
From: Gregory Price (Meta)
Date: Mon Nov 23 2026 - 09:05:27 EST
On 2026-11-22 11:47 -0500, Yury Norov wrote:
> On Fri, Nov 20, 2026 at 01:09:14PM -0500, Gregory Price via B4 Relay wrote:
> > From: "Gregory Price (Meta)" <gourry@xxxxxxxxxx>
> >
> > DAMON acquires folios to age them, check their accesses, and apply LRU
> > operations and migration. Treat these as general-purpose MM services
> > and restrict them to N_MEMORY_COMMON.
> >
> > Memory outside N_MEMORY_COMMON can still hold ordinary LRU folios, so
> > it would pass the checks that keep ZONE_DEVICE memory out of these
> > operations.
> >
> > Treat these folios like ZONE_DEVICE memory.
> >
> > DAMON cannot acquire such a folio, so it never ages one and virtual
> > address monitoring reports it as accessed, and DAMOS cannot isolate
> > one for migration.
> >
> > Signed-off-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
> > ---
> > mm/damon/ops-common.c | 5 +++--
> > mm/damon/vaddr.c | 2 +-
> > 2 files changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
> > index 15cabc79613b..57201a0c5e3a 100644
> > --- a/mm/damon/ops-common.c
> > +++ b/mm/damon/ops-common.c
> > @@ -17,8 +17,9 @@
> >
> > static bool damon_folio_acceptable(struct folio *folio, bool monitor)
> > {
> > - return folio_test_lru(folio) ||
> > - (monitor && folio_test_hugetlb(folio));
> > + return folio_is_common_memory(folio) &&
> > + (folio_test_lru(folio) ||
> > + (monitor && folio_test_hugetlb(folio)));
>
> Can you minimize the diff? That would also improve on readability IMO:
>
> if (!folio_is_common_memory())
> return false;
>
> return folio_test_lru(folio) ||
> (monitor && folio_test_hugetlb(folio));
that's reasonable, thanks!
--
~Gregory