back some mainline patches for damon
Alex Rusuf (1): mm/damon/core: fix return value from damos_wmark_metric_value
Huan Yang (1): mm/damon/core: remove unnecessary si_meminfo invoke.
mm/damon/core.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
From: Huan Yang link@vivo.com
mainline inclusion from mainline-v6.7-rc1 commit 987ffa5a3858bee448dc791cf6f596790aea52a8 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBDTU7
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
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.com Signed-off-by: Huan Yang link@vivo.com Reviewed-by: SeongJae Park sj@kernel.org Signed-off-by: Andrew Morton akpm@linux-foundation.org Signed-off-by: Ze Zuo zuoze1@huawei.com --- mm/damon/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c index ae55f20835b0..2e681072d49d 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1261,12 +1261,10 @@ static bool kdamond_need_stop(struct damon_ctx *ctx)
static unsigned long damos_wmark_metric_value(enum damos_wmark_metric metric) { - struct sysinfo i; - switch (metric) { case DAMOS_WMARK_FREE_MEM_RATE: - si_meminfo(&i); - return i.freeram * 1000 / i.totalram; + return global_zone_page_state(NR_FREE_PAGES) * 1000 / + totalram_pages(); default: break; }
From: Alex Rusuf yorha.op@gmail.com
mainline inclusion from mainline-v6.10-rc1 commit 3b15f9d1c22dfe82efd03cb7acc2eeb557c735b5 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBDTU7
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
damos_wmark_metric_value's return value is 'unsigned long', so returning -EINVAL as 'unsigned long' may turn out to be very different from the expected one (using 2's complement) and treat as usual matric's value. So, fix that, checking if returned value is not 0.
Link: https://lkml.kernel.org/r/20240506180238.53842-1-sj@kernel.org Fixes: ee801b7dd782 ("mm/damon/schemes: activate schemes based on a watermarks mechanism") Signed-off-by: Alex Rusuf yorha.op@gmail.com Reviewed-by: SeongJae Park sj@kernel.org Signed-off-by: SeongJae Park sj@kernel.org Signed-off-by: Andrew Morton akpm@linux-foundation.org Signed-off-by: Ze Zuo zuoze1@huawei.com --- mm/damon/core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c index 2e681072d49d..06884bcd6ac6 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1259,12 +1259,14 @@ static bool kdamond_need_stop(struct damon_ctx *ctx) return true; }
-static unsigned long damos_wmark_metric_value(enum damos_wmark_metric metric) +static int damos_get_wmark_metric_value(enum damos_wmark_metric metric, + unsigned long *metric_value) { switch (metric) { case DAMOS_WMARK_FREE_MEM_RATE: - return global_zone_page_state(NR_FREE_PAGES) * 1000 / + *metric_value = global_zone_page_state(NR_FREE_PAGES) * 1000 / totalram_pages(); + return 0; default: break; } @@ -1279,10 +1281,9 @@ static unsigned long damos_wmark_wait_us(struct damos *scheme) { unsigned long metric;
- if (scheme->wmarks.metric == DAMOS_WMARK_NONE) + if (damos_get_wmark_metric_value(scheme->wmarks.metric, &metric)) return 0;
- metric = damos_wmark_metric_value(scheme->wmarks.metric); /* higher than high watermark or lower than low watermark */ if (metric > scheme->wmarks.high || scheme->wmarks.low > metric) { if (scheme->wmarks.activated)
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/14322 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/Y...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/14322 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/Y...