[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220812012459.481215-1-zengjx95@gmail.com>
Date: Fri, 12 Aug 2022 09:24:59 +0800
From: Zeng Jingxiang <zengjx95@...il.com>
To: sj@...nel.org, akpm@...ux-foundation.org
Cc: damon@...ts.linux.dev, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Zeng Jingxiang <linuszeng@...cent.com>
Subject: [PATCH] mm/damon: remove dead code in damon_lru_sort_enabled_store()
From: Zeng Jingxiang <linuszeng@...cent.com>
The variable damon_lru_sort_initialized is always true, causing the
corresponding conditional expression cannot be executed.
Assigning true to damon_lru_sort_initialized here
544 damon_lru_sort_initialized = true;
The value of damon_lru_sort_initialized is always true.
As a result, the following expression cannot be executed.
463 if (!damon_lru_sort_initialized)
464 return rc;
Fixes: 40e983cca927 ("mm/damon: introduce DAMON-based LRU-lists Sorting")
Signed-off-by: Zeng Jingxiang <linuszeng@...cent.com>
---
mm/damon/lru_sort.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
index 9de6f00a71c5..e2a656e1b728 100644
--- a/mm/damon/lru_sort.c
+++ b/mm/damon/lru_sort.c
@@ -450,8 +450,6 @@ static void damon_lru_sort_timer_fn(struct work_struct *work)
}
static DECLARE_DELAYED_WORK(damon_lru_sort_timer, damon_lru_sort_timer_fn);
-static bool damon_lru_sort_initialized;
-
static int damon_lru_sort_enabled_store(const char *val,
const struct kernel_param *kp)
{
@@ -460,9 +458,6 @@ static int damon_lru_sort_enabled_store(const char *val,
if (rc < 0)
return rc;
- if (!damon_lru_sort_initialized)
- return rc;
-
schedule_delayed_work(&damon_lru_sort_timer, 0);
return 0;
@@ -541,7 +536,6 @@ static int __init damon_lru_sort_init(void)
schedule_delayed_work(&damon_lru_sort_timer, 0);
- damon_lru_sort_initialized = true;
return 0;
}
--
2.36.1
Powered by blists - more mailing lists