Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/5] mm/damon: introduce pgidle_set probe filter type
@ 2026-09-06 17:50 SJ Park
  2026-09-06 17:50 ` [RFC PATCH 1/5] mm/damon/api: introduce DAMON_FILTER_TYPE_PGIDLE_SET SJ Park
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: SJ Park @ 2026-09-06 17:50 UTC (permalink / raw)
  Cc: SJ Park, Liam R. Howlett, Andrew Morton, David Hildenbrand,
	Jonathan Corbet, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
	Randy Dunlap, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
	damon, linux-doc, linux-kernel, linux-mm

Users can do effective access monitoring with DAMON, using set_pgidle
probe prep operation and pgidle_unset allowing probe filter.  In the
setup, high probe_hits means the region was accessed frequently.  Zero
probe_hits means the region was not accessed.  The filter, however,
matches only the memory that can show the idleness.  Regions of zero
probe_hits may contain memory that was just unable to show the idleness.
On virtual address space based monitoring, for example, non-present
pages are reported as cold.  It is truly cold, but if the purpose is to
make some operations like reclaiming or compressing the data, this is
not really useful.  Introduce a new probe filter type, pgidle_set, that
confirms the page is marked as idle.  Using it instead of pgidle_unset,
users can find cold pages that can effectively be processed.

Patch 1 introduces the pgidle_set probe filter type to DAMON kernel API.
Patches 2 and 3 add support for it on physical and virtual address space
operation sets, respectively.  Patch 4 adds support for it on the DAMON
sysfs interface.  Finally, patch 5 updates the documentation for the new
filter type.

SJ Park (5):
  mm/damon/api: introduce DAMON_FILTER_TYPE_PGIDLE_SET
  mm/damon/paddr: support DAMON_FILTER_TYPE_PGIDLE_SET
  mm/damon/vaddr: support DAMON_FILTER_TYPE_PGIDLE_SET
  mm/damon/sysfs: support DAMON_FILTER_TYPE_PGIDLE_SET
  Docs/mm/damon/design: update for pgidle_set probe filter

 Documentation/mm/damon/design.rst | 3 ++-
 include/linux/damon.h             | 2 ++
 mm/damon/paddr.c                  | 6 ++++++
 mm/damon/sysfs.c                  | 4 ++++
 mm/damon/vaddr.c                  | 7 +++++++
 5 files changed, 21 insertions(+), 1 deletion(-)


base-commit: 1c9ae14f592158ed68845f7552f582545cb95c9a
-- 
2.47.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC PATCH 1/5] mm/damon/api: introduce DAMON_FILTER_TYPE_PGIDLE_SET
  2026-09-06 17:50 [RFC PATCH 0/5] mm/damon: introduce pgidle_set probe filter type SJ Park
@ 2026-09-06 17:50 ` SJ Park
  2026-09-06 17:50 ` [RFC PATCH 2/5] mm/damon/paddr: support DAMON_FILTER_TYPE_PGIDLE_SET SJ Park
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-06 17:50 UTC (permalink / raw)
  Cc: SJ Park, damon, linux-kernel, linux-mm

DAMON_FILTER_TYPE_PGIDLE_UNSET matches only memory that was able to
confirm if it is marked as idle.  If the memory cannot be marked as
idle, it simply doesn't match.  Hence, finding memory that was marked as
idle with only DAMON_FILTER_TYPE_PGIDLE_UNSET is impossible.  Introduce
a new filter for the purpose, DAMON_FILTER_TYPE_PGIDLE_SET.

Signed-off-by: SJ Park <sj@kernel.org>
---
 include/linux/damon.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/damon.h b/include/linux/damon.h
index 871d26adf6ae5..16800b3dc379b 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -774,11 +774,13 @@ struct damon_prep {
  * @DAMON_FILTER_TYPE_ANON:		Anonymous pages.
  * @DAMON_FILTER_TYPE_MEMCG:		Specific memcg's pages.
  * @DAMON_FILTER_TYPE_PGIDLE_UNSET:	Pgidle is unset.
+ * @DAMON_FILTER_TYPE_PGIDLE_SET:	Pgidle is set.
  */
 enum damon_filter_type {
 	DAMON_FILTER_TYPE_ANON,
 	DAMON_FILTER_TYPE_MEMCG,
 	DAMON_FILTER_TYPE_PGIDLE_UNSET,
+	DAMON_FILTER_TYPE_PGIDLE_SET,
 };
 
 /**
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RFC PATCH 2/5] mm/damon/paddr: support DAMON_FILTER_TYPE_PGIDLE_SET
  2026-09-06 17:50 [RFC PATCH 0/5] mm/damon: introduce pgidle_set probe filter type SJ Park
  2026-09-06 17:50 ` [RFC PATCH 1/5] mm/damon/api: introduce DAMON_FILTER_TYPE_PGIDLE_SET SJ Park
@ 2026-09-06 17:50 ` SJ Park
  2026-09-06 17:50 ` [RFC PATCH 3/5] mm/damon/vaddr: " SJ Park
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-06 17:50 UTC (permalink / raw)
  Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm

Implement DAMON_FILTER_TYPE_PGIDLE_SET support on the physical address
space DAMON operation set (paddr).

Signed-off-by: SJ Park <sj@kernel.org>
---
 mm/damon/paddr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index d7c81829445ba..79195026b903a 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -151,6 +151,12 @@ static bool damon_pa_filter_match(struct damon_filter *filter,
 		else
 			matched = damon_folio_young(folio);
 		break;
+	case DAMON_FILTER_TYPE_PGIDLE_SET:
+		if (!folio)
+			matched = false;
+		else
+			matched = damon_folio_young(folio) == false;
+		break;
 	default:
 		return damon_ops_filter_match(filter, folio);
 	}
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RFC PATCH 3/5] mm/damon/vaddr: support DAMON_FILTER_TYPE_PGIDLE_SET
  2026-09-06 17:50 [RFC PATCH 0/5] mm/damon: introduce pgidle_set probe filter type SJ Park
  2026-09-06 17:50 ` [RFC PATCH 1/5] mm/damon/api: introduce DAMON_FILTER_TYPE_PGIDLE_SET SJ Park
  2026-09-06 17:50 ` [RFC PATCH 2/5] mm/damon/paddr: support DAMON_FILTER_TYPE_PGIDLE_SET SJ Park
@ 2026-09-06 17:50 ` SJ Park
  2026-09-06 17:50 ` [RFC PATCH 4/5] mm/damon/sysfs: " SJ Park
  2026-09-06 17:50 ` [RFC PATCH 5/5] Docs/mm/damon/design: update for pgidle_set probe filter SJ Park
  4 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-06 17:50 UTC (permalink / raw)
  Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm

Implement DAMON_FILTER_TYPE_PGIDLE_SET support on the virtual address
space DAMON operation set (vaddr).

Signed-off-by: SJ Park <sj@kernel.org>
---
 mm/damon/vaddr.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index 9a38dc89a156e..7063356370c34 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -550,6 +550,13 @@ static bool damon_va_filter_match(struct damon_filter *filter,
 			matched = damon_va_young_addr(folio, pte, pmd, mm,
 					addr);
 		break;
+	case DAMON_FILTER_TYPE_PGIDLE_SET:
+		if (!folio)
+			matched = false;
+		else
+			matched = !damon_va_young_addr(folio, pte, pmd, mm,
+					addr);
+		break;
 	default:
 		return damon_ops_filter_match(filter, folio);
 	}
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RFC PATCH 4/5] mm/damon/sysfs: support DAMON_FILTER_TYPE_PGIDLE_SET
  2026-09-06 17:50 [RFC PATCH 0/5] mm/damon: introduce pgidle_set probe filter type SJ Park
                   ` (2 preceding siblings ...)
  2026-09-06 17:50 ` [RFC PATCH 3/5] mm/damon/vaddr: " SJ Park
@ 2026-09-06 17:50 ` SJ Park
  2026-09-06 17:50 ` [RFC PATCH 5/5] Docs/mm/damon/design: update for pgidle_set probe filter SJ Park
  4 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-06 17:50 UTC (permalink / raw)
  Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm

Extend DAMON sysfs interface to let users setup
DAMON_FILTER_TYPE_PGIDLE_SET probe filter.

Signed-off-by: SJ Park <sj@kernel.org>
---
 mm/damon/sysfs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index b576e97cbfdb8..51fa506c879b0 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1001,6 +1001,10 @@ damon_sysfs_filter_type_names[] = {
 		.type = DAMON_FILTER_TYPE_PGIDLE_UNSET,
 		.name = "pgidle_unset",
 	},
+	{
+		.type = DAMON_FILTER_TYPE_PGIDLE_SET,
+		.name = "pgidle_set",
+	},
 };
 
 static ssize_t type_show(struct kobject *kobj,
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RFC PATCH 5/5] Docs/mm/damon/design: update for pgidle_set probe filter
  2026-09-06 17:50 [RFC PATCH 0/5] mm/damon: introduce pgidle_set probe filter type SJ Park
                   ` (3 preceding siblings ...)
  2026-09-06 17:50 ` [RFC PATCH 4/5] mm/damon/sysfs: " SJ Park
@ 2026-09-06 17:50 ` SJ Park
  4 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-06 17:50 UTC (permalink / raw)
  Cc: SJ Park, Liam R. Howlett, Andrew Morton, David Hildenbrand,
	Jonathan Corbet, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
	Randy Dunlap, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
	damon, linux-doc, linux-kernel, linux-mm

Update DAMON design document for the newly added pgidle_set probe filter
type.

Signed-off-by: SJ Park <sj@kernel.org>
---
 Documentation/mm/damon/design.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst
index aac84de261aa8..22b785cd11dfe 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -299,6 +299,7 @@ filter types.  Currently below filter types are supported.
 - ``memcg``: Same to that for DAMOS filters.
 - ``pgidle_unset``: Matches if the page for the memory is marked as not
   access-idle.
+- ``pgidle_set``: Matches if the page for the memory is marked as access-idle.
 
 If such probes are registered, DAMON executes the probes for each region's
 sampling memory when it does the access :ref:`sampling
@@ -314,7 +315,7 @@ actions are registered, DAMON applies the actions to each region's sampling
 memory before starting the next sampling interval.  Currently only one action,
 ``set_pgidle`` is supported.  The action marks the page for the probing target
 memory as access-idle.  This can be useful to be used together with
-``pgidle_unset`` probe filter.
+``pgidle_unset`` or ``pgidle_set`` probe filter.
 
 This is a sampling based mechanism.  Hence, it is lightweight but the output
 may include some measurement errors.  The output should be used with good
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-06 17:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-06 17:50 [RFC PATCH 0/5] mm/damon: introduce pgidle_set probe filter type SJ Park
2026-09-06 17:50 ` [RFC PATCH 1/5] mm/damon/api: introduce DAMON_FILTER_TYPE_PGIDLE_SET SJ Park
2026-09-06 17:50 ` [RFC PATCH 2/5] mm/damon/paddr: support DAMON_FILTER_TYPE_PGIDLE_SET SJ Park
2026-09-06 17:50 ` [RFC PATCH 3/5] mm/damon/vaddr: " SJ Park
2026-09-06 17:50 ` [RFC PATCH 4/5] mm/damon/sysfs: " SJ Park
2026-09-06 17:50 ` [RFC PATCH 5/5] Docs/mm/damon/design: update for pgidle_set probe filter SJ Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox