[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210720131309.22073-10-sj38.park@gmail.com>
Date: Tue, 20 Jul 2021 13:13:03 +0000
From: SeongJae Park <sj38.park@...il.com>
To: akpm@...ux-foundation.org
Cc: SeongJae Park <sjpark@...zon.de>, Jonathan.Cameron@...wei.com,
acme@...nel.org, alexander.shishkin@...ux.intel.com,
amit@...nel.org, benh@...nel.crashing.org,
brendanhiggins@...gle.com, corbet@....net, david@...hat.com,
dwmw@...zon.com, elver@...gle.com, fan.du@...el.com,
foersleo@...zon.de, greg@...ah.com, gthelen@...gle.com,
guoju.fgj@...baba-inc.com, jgowans@...zon.com, joe@...ches.com,
mgorman@...e.de, mheyne@...zon.de, minchan@...nel.org,
mingo@...hat.com, namhyung@...nel.org, peterz@...radead.org,
riel@...riel.com, rientjes@...gle.com, rostedt@...dmis.org,
rppt@...nel.org, shakeelb@...gle.com, shuah@...nel.org,
sieberf@...zon.com, sj38.park@...il.com, snu@...le79.org,
vbabka@...e.cz, vdavydov.dev@...il.com, zgf574564920@...il.com,
linux-damon@...zon.com, linux-mm@...ck.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [RFC v3 09/15] mm/damon/dbgfs: Support prioritization weights
From: SeongJae Park <sjpark@...zon.de>
This commit allows DAMON debugfs interface users set the prioritization
weights by putting three more numbers to the 'schemes' file.
Signed-off-by: SeongJae Park <sjpark@...zon.de>
---
mm/damon/dbgfs.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c
index 3cd253a07116..93ac15cb5786 100644
--- a/mm/damon/dbgfs.c
+++ b/mm/damon/dbgfs.c
@@ -227,13 +227,16 @@ static ssize_t sprint_schemes(struct damon_ctx *c, char *buf, ssize_t len)
damon_for_each_scheme(s, c) {
rc = scnprintf(&buf[written], len - written,
- "%lu %lu %u %u %u %u %d %lu %lu %lu %lu %lu\n",
+ "%lu %lu %u %u %u %u %d %lu %lu %lu %u %u %u %lu %lu\n",
s->min_sz_region, s->max_sz_region,
s->min_nr_accesses, s->max_nr_accesses,
s->min_age_region, s->max_age_region,
s->action,
s->quota.ms, s->quota.sz,
s->quota.reset_interval,
+ s->quota.weight_sz,
+ s->quota.weight_nr_accesses,
+ s->quota.weight_age,
s->stat_count, s->stat_sz);
if (!rc)
return -ENOMEM;
@@ -315,11 +318,14 @@ static struct damos **str_to_schemes(const char *str, ssize_t len,
while (pos < len && *nr_schemes < max_nr_schemes) {
struct damos_quota quota = {};
- ret = sscanf(&str[pos], "%lu %lu %u %u %u %u %u %lu %lu %lu%n",
+ ret = sscanf(&str[pos],
+ "%lu %lu %u %u %u %u %u %lu %lu %lu %u %u %u%n",
&min_sz, &max_sz, &min_nr_a, &max_nr_a,
&min_age, &max_age, &action, "a.ms,
- "a.sz, "a.reset_interval, &parsed);
- if (ret != 10)
+ "a.sz, "a.reset_interval,
+ "a.weight_sz, "a.weight_nr_accesses,
+ "a.weight_age, &parsed);
+ if (ret != 13)
break;
if (!damos_action_valid(action)) {
pr_err("wrong action %d\n", action);
@@ -1147,7 +1153,7 @@ static ssize_t dbgfs_monitor_on_write(struct file *file,
static ssize_t dbgfs_version_read(struct file *file,
char __user *buf, size_t count, loff_t *ppos)
{
- return simple_read_from_buffer(buf, count, ppos, "1\n", 2);
+ return simple_read_from_buffer(buf, count, ppos, "2\n", 2);
}
static const struct file_operations mk_contexts_fops = {
--
2.17.1
Powered by blists - more mailing lists