[PATCH] mm/damon: add MADV_COLLAPSE support in damos_action
From: Xin Hao
Date: Tue Sep 13 2022 - 07:48:00 EST
MADV_COLLAPSE has large different with MDVA_HUGE in dealing with huge
pages, it doesn't need to rely on 'khugepage' thread to create THP.
So combining with it will give damon users more options.
Signed-off-by: Xin Hao <xhao@xxxxxxxxxxxxxxxxx>
---
include/linux/damon.h | 1 +
mm/damon/vaddr.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 016b6c9c03d6..c44f9410d997 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -97,6 +97,7 @@ enum damos_action {
DAMOS_PAGEOUT,
DAMOS_HUGEPAGE,
DAMOS_NOHUGEPAGE,
+ DAMOS_COLLAPSE,
DAMOS_LRU_PRIO,
DAMOS_LRU_DEPRIO,
DAMOS_STAT, /* Do nothing but only record the stat */
diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index c2c08c1b316b..58c0d068563d 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -655,6 +655,9 @@ static unsigned long damon_va_apply_scheme(struct damon_ctx *ctx,
case DAMOS_NOHUGEPAGE:
madv_action = MADV_NOHUGEPAGE;
break;
+ case DAMOS_COLLAPSE:
+ madv_action = MADV_COLLAPSE;
+ break;
case DAMOS_STAT:
return 0;
default:
--
2.31.0