From 5d418556be086230d64d299079e84b504c3e0146 Mon Sep 17 00:00:00 2001 From: SeongJae Park Date: Thu, 27 Jan 2022 14:36:48 +0800 Subject: [PATCH] mm/damon/core: use better timer mechanisms selection threshold mainline inclusion from mainline-v5.16-rc5 commit 4de46a30b9929d3d1b29e481d48e9c25f8ac7919 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=4de46a30b9929d3d1b29e481d48e9c25f8ac7919 -------------------------------- Patch series "mm/damon: Trivial fixups and improvements". This patchset contains trivial fixups and improvements for DAMON and its kunit/kselftest tests. This patch (of 11): DAMON is using hrtimer if requested sleep time is <=100ms, while the suggested threshold[1] is <=20ms. This commit applies the threshold. [1] Documentation/timers/timers-howto.rst Link: https://lkml.kernel.org/r/20211201150440.1088-2-sj@kernel.org Fixes: ee801b7dd7822 ("mm/damon/schemes: activate schemes based on a watermarks mechanism") Signed-off-by: SeongJae Park Cc: Shuah Khan Cc: Brendan Higgins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds (cherry picked from commit 4de46a30b9929d3d1b29e481d48e9c25f8ac7919) Signed-off-by: Yue Zou Reviewed-by: Kefeng Wang Signed-off-by: Zheng Zengkai --- mm/damon/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index 2daffd5820fe..eefb2ada67ca 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -980,7 +980,8 @@ static unsigned long damos_wmark_wait_us(struct damos *scheme) static void kdamond_usleep(unsigned long usecs) { - if (usecs > 100 * 1000) + /* See Documentation/timers/timers-howto.rst for the thresholds */ + if (usecs > 20 * USEC_PER_MSEC) schedule_timeout_idle(usecs_to_jiffies(usecs)); else usleep_idle_range(usecs, usecs + 1); -- GitLab