public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/damon: remove dead code in damon_lru_sort_enabled_store()
@ 2022-08-12  1:24 Zeng Jingxiang
  2022-08-12  1:50 ` SeongJae Park
  0 siblings, 1 reply; 2+ messages in thread
From: Zeng Jingxiang @ 2022-08-12  1:24 UTC (permalink / raw)
  To: sj, akpm; +Cc: damon, linux-mm, linux-kernel, Zeng Jingxiang

From: Zeng Jingxiang <linuszeng@tencent.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@tencent.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-12  1:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-12  1:24 [PATCH] mm/damon: remove dead code in damon_lru_sort_enabled_store() Zeng Jingxiang
2022-08-12  1:50 ` SeongJae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox