Re: [PATCH] mm/damon: remove dead code in damon_lru_sort_enabled_store()

From: SeongJae Park
Date: Thu Aug 11 2022 - 21:50:28 EST


Hi Zeng,

On Fri, 12 Aug 2022 09:24:59 +0800 Zeng Jingxiang <zengjx95@xxxxxxxxx> wrote:

> From: Zeng Jingxiang <linuszeng@xxxxxxxxxxx>
>
> 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;

Before the assignment, the variable is set 'false'.

>
> 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;

If this code is executed before the assignment, the expression can be executed.

Actually, there was a bug due to the absence of the variable. You may refer to
that for the detail:
https://lore.kernel.org/damon/20220604192222.1488-1-sj@xxxxxxxxxx/T/#t


Thanks,
SJ

[...]