Commit 987ffa5a authored by Huan Yang's avatar Huan Yang Committed by Andrew Morton

mm/damon/core: remove unnecessary si_meminfo invoke.

si_meminfo() will read and assign more info not just free/ram pages.  For
just DAMOS_WMARK_FREE_MEM_RATE use, only get free and ram pages is ok to
save cpu.

Link: https://lkml.kernel.org/r/20230920015727.4482-1-link@vivo.comSigned-off-by: default avatarHuan Yang <link@vivo.com>
Reviewed-by: default avatarSeongJae Park <sj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 8c9ae56d
...@@ -1326,12 +1326,10 @@ static bool kdamond_need_stop(struct damon_ctx *ctx) ...@@ -1326,12 +1326,10 @@ static bool kdamond_need_stop(struct damon_ctx *ctx)
static unsigned long damos_wmark_metric_value(enum damos_wmark_metric metric) static unsigned long damos_wmark_metric_value(enum damos_wmark_metric metric)
{ {
struct sysinfo i;
switch (metric) { switch (metric) {
case DAMOS_WMARK_FREE_MEM_RATE: case DAMOS_WMARK_FREE_MEM_RATE:
si_meminfo(&i); return global_zone_page_state(NR_FREE_PAGES) * 1000 /
return i.freeram * 1000 / i.totalram; totalram_pages();
default: default:
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment