From: Honggyu Kim <honggyu.kim@sk.com>
To: sj@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org
Cc: akpm@linux-foundation.org, apopple@nvidia.com,
baolin.wang@linux.alibaba.com, dave.jiang@intel.com,
honggyu.kim@sk.com, hyeongtak.ji@sk.com, kernel_team@skhynix.com,
linmiaohe@huawei.com, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org,
mathieu.desnoyers@efficios.com, mhiramat@kernel.org,
rakie.kim@sk.com, rostedt@goodmis.org, surenb@google.com,
yangx.jy@fujitsu.com, ying.huang@intel.com, ziy@nvidia.com,
42.hyeyoo@gmail.com, art.jeongseob@gmail.com
Subject: [RFC PATCH v3 7/7] mm/damon: Add "damon_migrate_{hot,cold}" vmstat
Date: Fri, 5 Apr 2024 15:08:56 +0900 [thread overview]
Message-ID: <20240405060858.2818-8-honggyu.kim@sk.com> (raw)
In-Reply-To: <20240405060858.2818-1-honggyu.kim@sk.com>
This patch adds "damon_migrate_{hot,cold}" under node specific vmstat
counters at the following location.
/sys/devices/system/node/node*/vmstat
The counted values are accumulcated to the global vmstat so it also
introduces the same counter at /proc/vmstat as well.
Signed-off-by: Honggyu Kim <honggyu.kim@sk.com>
---
include/linux/mmzone.h | 4 ++++
mm/damon/paddr.c | 17 ++++++++++++++++-
mm/vmstat.c | 4 ++++
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index a497f189d988..0005372c5503 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -214,6 +214,10 @@ enum node_stat_item {
PGDEMOTE_KSWAPD,
PGDEMOTE_DIRECT,
PGDEMOTE_KHUGEPAGED,
+#ifdef CONFIG_DAMON_PADDR
+ DAMON_MIGRATE_HOT,
+ DAMON_MIGRATE_COLD,
+#endif
NR_VM_NODE_STAT_ITEMS
};
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index fd9d35b5cc83..d559c242d151 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -235,10 +235,23 @@ enum migration_mode {
static unsigned int migrate_folio_list(struct list_head *migrate_folios,
struct pglist_data *pgdat,
+ enum migration_mode mm,
int target_nid)
{
unsigned int nr_succeeded;
nodemask_t allowed_mask = NODE_MASK_NONE;
+ enum node_stat_item node_stat;
+
+ switch (mm) {
+ case MIG_MIGRATE_HOT:
+ node_stat = DAMON_MIGRATE_HOT;
+ break;
+ case MIG_MIGRATE_COLD:
+ node_stat = DAMON_MIGRATE_COLD;
+ break;
+ default:
+ return 0;
+ }
struct migration_target_control mtc = {
/*
@@ -263,6 +276,8 @@ static unsigned int migrate_folio_list(struct list_head *migrate_folios,
(unsigned long)&mtc, MIGRATE_ASYNC, MR_DAMON,
&nr_succeeded);
+ mod_node_page_state(pgdat, node_stat, nr_succeeded);
+
return nr_succeeded;
}
@@ -302,7 +317,7 @@ static unsigned int damon_pa_migrate_folio_list(struct list_head *folio_list,
/* 'folio_list' is always empty here */
/* Migrate folios selected for migration */
- nr_migrated += migrate_folio_list(&migrate_folios, pgdat, target_nid);
+ nr_migrated += migrate_folio_list(&migrate_folios, pgdat, mm, target_nid);
/* Folios that could not be migrated are still in @migrate_folios */
if (!list_empty(&migrate_folios)) {
/* Folios which weren't migrated go back on @folio_list */
diff --git a/mm/vmstat.c b/mm/vmstat.c
index db79935e4a54..be9ba89fede1 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1252,6 +1252,10 @@ const char * const vmstat_text[] = {
"pgdemote_kswapd",
"pgdemote_direct",
"pgdemote_khugepaged",
+#ifdef CONFIG_DAMON_PADDR
+ "damon_migrate_hot",
+ "damon_migrate_cold",
+#endif
/* enum writeback_stat_item counters */
"nr_dirty_threshold",
--
2.34.1
next prev parent reply other threads:[~2024-04-05 6:09 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 6:08 [RFC PATCH v3 0/7] DAMON based tiered memory management for CXL memory Honggyu Kim
2024-04-05 6:08 ` [RFC PATCH v3 1/7] mm/damon/paddr: refactor DAMOS_PAGEOUT with migration_mode Honggyu Kim
2024-04-05 19:19 ` SeongJae Park
2024-05-11 20:16 ` SeongJae Park
2024-05-12 18:00 ` SeongJae Park
2024-04-05 6:08 ` [RFC PATCH v3 2/7] mm: make alloc_demote_folio externally invokable for migration Honggyu Kim
2024-04-05 19:20 ` SeongJae Park
2024-04-05 6:08 ` [RFC PATCH v3 3/7] mm/damon/sysfs-schemes: add target_nid on sysfs-schemes Honggyu Kim
2024-04-05 6:08 ` [RFC PATCH v3 4/7] mm/migrate: add MR_DAMON to migrate_reason Honggyu Kim
2024-04-05 19:20 ` SeongJae Park
2024-04-05 6:08 ` [RFC PATCH v3 5/7] mm/damon/paddr: introduce DAMOS_MIGRATE_COLD action for demotion Honggyu Kim
2024-04-05 19:24 ` SeongJae Park
2024-04-08 12:06 ` Honggyu Kim
2024-04-08 17:52 ` SeongJae Park
2024-04-09 9:54 ` Honggyu Kim
2024-04-09 16:18 ` SeongJae Park
2024-04-05 6:08 ` [RFC PATCH v3 6/7] mm/damon/paddr: introduce DAMOS_MIGRATE_HOT action for promotion Honggyu Kim
2024-04-05 19:26 ` SeongJae Park
2024-04-05 6:08 ` Honggyu Kim [this message]
2024-04-05 19:27 ` [RFC PATCH v3 7/7] mm/damon: Add "damon_migrate_{hot,cold}" vmstat SeongJae Park
2024-04-05 16:56 ` [RFC PATCH v3 0/7] DAMON based tiered memory management for CXL memory Gregory Price
2024-04-08 13:41 ` [RFC PATCH v3 0/7] DAMON based tiered memory management for CXL Honggyu Kim
2024-04-09 9:59 ` Honggyu Kim
2024-04-10 0:00 ` Gregory Price
2024-04-05 19:28 ` [RFC PATCH v3 0/7] DAMON based tiered memory management for CXL memory SeongJae Park
2024-04-08 10:56 ` Honggyu Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240405060858.2818-8-honggyu.kim@sk.com \
--to=honggyu.kim@sk.com \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=art.jeongseob@gmail.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=damon@lists.linux.dev \
--cc=dave.jiang@intel.com \
--cc=hyeongtak.ji@sk.com \
--cc=kernel_team@skhynix.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rakie.kim@sk.com \
--cc=rostedt@goodmis.org \
--cc=sj@kernel.org \
--cc=surenb@google.com \
--cc=yangx.jy@fujitsu.com \
--cc=ying.huang@intel.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox