lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251208062943.68824-36-sj@kernel.org>
Date: Sun,  7 Dec 2025 22:29:39 -0800
From: SeongJae Park <sj@...nel.org>
To: 
Cc: SeongJae Park <sj@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	damon@...ts.linux.dev,
	linux-kernel@...r.kernel.org,
	linux-mm@...ck.org
Subject: [RFC PATCH v3 35/37] mm/damon/core: support write access sample filter

Now page fault events based access reports contain information about if
the access was for a read or a write.  Doing sampling results filtering
based on the information can be useful.  Introduce a new type of damon
sample filter for that.

Signed-off-by: SeongJae Park <sj@...nel.org>
---
 include/linux/damon.h | 9 ++++++---
 mm/damon/core.c       | 5 +++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/linux/damon.h b/include/linux/damon.h
index 9299fc91ba27..f9fd26f7eab8 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -790,12 +790,14 @@ struct damon_primitives_enabled {
  *
  * @DAMON_FILTER_TYPE_CPUMASK:	Filter by access-generated CPUs.
  * @DAMON_FILTER_TYPE_THREADS:	Filter by access-generated threads.
+ * @DAMON_FILTER_TYPE_WRITE:	Filter by whether the access was for writing.
  *
  * Read &struct damon_sample_control for more details.
  */
 enum damon_sample_filter_type {
 	DAMON_FILTER_TYPE_CPUMASK,
 	DAMON_FILTER_TYPE_THREADS,
+	DAMON_FILTER_TYPE_WRITE,
 };
 
 /**
@@ -836,9 +838,10 @@ struct damon_sample_filter {
  * that to make higher access pattern picture.  It can use multiple sampling
  * primitives including page table accessed bits and page fault events.  It can
  * also filter in/out specific types of sampled access events to monitor
- * accesses of specific types, such as access-generated CPUs and threads.  This
- * struct is for controlling what sampling primitives to use (enable), and what
- * sampled access events should be filtered in/out.
+ * accesses of specific types, such as access-generated CPUs, threads, and
+ * whether it was for read or writes.  This struct is for controlling what
+ * sampling primitives to use (enable), and what sampled access events should
+ * be filtered in/out.
  */
 struct damon_sample_control {
 	struct damon_primitives_enabled primitives_enabled;
diff --git a/mm/damon/core.c b/mm/damon/core.c
index e2fd17b83a92..5f29e4dee267 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1336,6 +1336,8 @@ static int damon_commit_sample_filter_arg(struct damon_sample_filter *dst,
 				src->nr_tids);
 		dst->nr_tids = src->nr_tids;
 		break;
+	case DAMON_FILTER_TYPE_WRITE:
+		break;
 	default:
 		break;
 	}
@@ -2912,6 +2914,9 @@ static bool damon_sample_filter_matching(struct damon_access_report *report,
 			break;
 		}
 		break;
+	case DAMON_FILTER_TYPE_WRITE:
+		matched = report->is_write;
+		break;
 	default:
 		break;
 	}
-- 
2.47.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ