@@ -326,6 +326,7 @@ struct damos_stat {
* @DAMOS_FILTER_TYPE_ANON: Anonymous pages.
* @DAMOS_FILTER_TYPE_MEMCG: Specific memcg's pages.
* @DAMOS_FILTER_TYPE_YOUNG: Recently accessed pages.
+ * @DAMOS_FILTER_TYPE_HUGEPAGE: Page is part of a hugepage.
* @DAMOS_FILTER_TYPE_ADDR: Address range.
* @DAMOS_FILTER_TYPE_TARGET: Data Access Monitoring target.
* @NR_DAMOS_FILTER_TYPES: Number of filter types.
@@ -345,6 +346,9 @@ enum damos_filter_type {
DAMOS_FILTER_TYPE_ANON,
DAMOS_FILTER_TYPE_MEMCG,
DAMOS_FILTER_TYPE_YOUNG,
+#if defined(CONFIG_PGTABLE_HAS_HUGE_LEAVES)
+ DAMOS_FILTER_TYPE_HUGEPAGE,
+#endif
DAMOS_FILTER_TYPE_ADDR,
DAMOS_FILTER_TYPE_TARGET,
NR_DAMOS_FILTER_TYPES,
@@ -222,6 +222,11 @@ static bool damos_pa_filter_match(struct damos_filter *filter,
if (matched)
damon_folio_mkold(folio);
break;
+#if defined(CONFIG_PGTABLE_HAS_HUGE_LEAVES)
+ case DAMOS_FILTER_TYPE_HUGEPAGE:
+ matched = folio_size(folio) == HPAGE_PMD_SIZE;
+ break;
+#endif
default:
break;
}
@@ -329,6 +329,9 @@ static const char * const damon_sysfs_scheme_filter_type_strs[] = {
"anon",
"memcg",
"young",
+#if defined(CONFIG_PGTABLE_HAS_HUGE_LEAVES)
+ "hugepage",
+#endif
"addr",
"target",
};
This is to gather statistics to check if memory regions of specific access tempratures are backed by hugepages. This includes both THPs and hugetlbfs. This filter can help to observe and prove the effectivenes of different schemes for shrinking/collapsing hugepages. Signed-off-by: Usama Arif <usamaarif642@gmail.com> --- v1 -> v2: - Wrap DAMOS_FILTER_TYPE_HUGEPAGE case with CONFIG_PGTABLE_HAS_HUGE_LEAVES (SJ Park) --- include/linux/damon.h | 4 ++++ mm/damon/paddr.c | 5 +++++ mm/damon/sysfs-schemes.c | 3 +++ 3 files changed, 12 insertions(+)