提交 f241da89 编写于 作者: S SeongJae Park 提交者: Zheng Zengkai

mm/damon/schemes: account how many times quota limit has exceeded

mainline inclusion
from mainline-v5.17-rc1
commit 6268eac3
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4RTX9

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6268eac34ca30af7f6313504d556ec7fcd295621

--------------------------------

If the time/space quotas of a given DAMON-based operation scheme is too
small, the scheme could show unexpectedly slow progress.  However, there
is no good way to notice the case in runtime.  This commit extends the
DAMOS stat to provide how many times the quota limits exceeded so that
the users can easily notice the case and tune the scheme.

Link: https://lkml.kernel.org/r/20211210150016.35349-3-sj@kernel.orgSigned-off-by: NSeongJae Park <sj@kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 6268eac3)
Signed-off-by: NYue Zou <zouyue3@huawei.com>
Reviewed-by: Kefeng Wang<wangkefeng.wang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 cdc7ff7e
...@@ -198,12 +198,14 @@ struct damos_watermarks { ...@@ -198,12 +198,14 @@ struct damos_watermarks {
* @sz_tried: Total size of regions that the scheme is tried to be applied. * @sz_tried: Total size of regions that the scheme is tried to be applied.
* @nr_applied: Total number of regions that the scheme is applied. * @nr_applied: Total number of regions that the scheme is applied.
* @sz_applied: Total size of regions that the scheme is applied. * @sz_applied: Total size of regions that the scheme is applied.
* @qt_exceeds: Total number of times the quota of the scheme has exceeded.
*/ */
struct damos_stat { struct damos_stat {
unsigned long nr_tried; unsigned long nr_tried;
unsigned long sz_tried; unsigned long sz_tried;
unsigned long nr_applied; unsigned long nr_applied;
unsigned long sz_applied; unsigned long sz_applied;
unsigned long qt_exceeds;
}; };
/** /**
......
...@@ -693,6 +693,8 @@ static void kdamond_apply_schemes(struct damon_ctx *c) ...@@ -693,6 +693,8 @@ static void kdamond_apply_schemes(struct damon_ctx *c)
if (time_after_eq(jiffies, quota->charged_from + if (time_after_eq(jiffies, quota->charged_from +
msecs_to_jiffies( msecs_to_jiffies(
quota->reset_interval))) { quota->reset_interval))) {
if (quota->esz && quota->charged_sz >= quota->esz)
s->stat.qt_exceeds++;
quota->total_charged_sz += quota->charged_sz; quota->total_charged_sz += quota->charged_sz;
quota->charged_from = jiffies; quota->charged_from = jiffies;
quota->charged_sz = 0; quota->charged_sz = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册