Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon/sysfs-schemes: introduce nr_snapshots damos stat file

Introduce a new DAMON sysfs interface file for exposing the newly added
DAMOS stat, nr_snapshots. The file has the name same to the stat name
(nr_snapshots) and placed under the damos stat sysfs directory.

Link: https://lkml.kernel.org/r/20251216080128.42991-3-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
83a741b9 4a6ceb7c

+15
+15
mm/damon/sysfs-schemes.c
··· 204 204 unsigned long sz_applied; 205 205 unsigned long sz_ops_filter_passed; 206 206 unsigned long qt_exceeds; 207 + unsigned long nr_snapshots; 207 208 }; 208 209 209 210 static struct damon_sysfs_stats *damon_sysfs_stats_alloc(void) ··· 266 265 return sysfs_emit(buf, "%lu\n", stats->qt_exceeds); 267 266 } 268 267 268 + static ssize_t nr_snapshots_show(struct kobject *kobj, 269 + struct kobj_attribute *attr, char *buf) 270 + { 271 + struct damon_sysfs_stats *stats = container_of(kobj, 272 + struct damon_sysfs_stats, kobj); 273 + 274 + return sysfs_emit(buf, "%lu\n", stats->nr_snapshots); 275 + } 276 + 269 277 static void damon_sysfs_stats_release(struct kobject *kobj) 270 278 { 271 279 kfree(container_of(kobj, struct damon_sysfs_stats, kobj)); ··· 298 288 static struct kobj_attribute damon_sysfs_stats_qt_exceeds_attr = 299 289 __ATTR_RO_MODE(qt_exceeds, 0400); 300 290 291 + static struct kobj_attribute damon_sysfs_stats_nr_snapshots_attr = 292 + __ATTR_RO_MODE(nr_snapshots, 0400); 293 + 301 294 static struct attribute *damon_sysfs_stats_attrs[] = { 302 295 &damon_sysfs_stats_nr_tried_attr.attr, 303 296 &damon_sysfs_stats_sz_tried_attr.attr, ··· 308 295 &damon_sysfs_stats_sz_applied_attr.attr, 309 296 &damon_sysfs_stats_sz_ops_filter_passed_attr.attr, 310 297 &damon_sysfs_stats_qt_exceeds_attr.attr, 298 + &damon_sysfs_stats_nr_snapshots_attr.attr, 311 299 NULL, 312 300 }; 313 301 ATTRIBUTE_GROUPS(damon_sysfs_stats); ··· 2776 2762 sysfs_stats->sz_ops_filter_passed = 2777 2763 scheme->stat.sz_ops_filter_passed; 2778 2764 sysfs_stats->qt_exceeds = scheme->stat.qt_exceeds; 2765 + sysfs_stats->nr_snapshots = scheme->stat.nr_snapshots; 2779 2766 } 2780 2767 } 2781 2768