[RFC PATCH v4 13/16] mm/mglru: remove redundant gens <= MIN_NR_GENS check in should_run_aging()

"Barry Song (Xiaomi)" <[email protected]>
Newsgroups org.kvack.linux-mm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: Bo Zhang <[email protected]>

If the following condition is true,

        if (min_seq[type] + MIN_NR_GENS > max_seq)
                return true;

then this one must also be true,

        if (evictable_min_seq(min_seq, swappiness) + MIN_NR_GENS > max_seq)
                return true;

The converse is not true, so the evictable_min_seq() check is
redundant and can be removed.

Signed-off-by: Bo Zhang <[email protected]>
Signed-off-by: Barry Song (Xiaomi) <[email protected]>
---
 mm/vmscan.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 50f0bcf9576c..a276560bc66b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -5098,10 +5098,6 @@ static bool should_run_aging(struct lruvec *lruvec, unsigned long max_seq,
 	int type = get_type_to_scan(lruvec, swappiness);
 	DEFINE_MIN_SEQ(lruvec);
 
-	/* have to run aging, since eviction is not possible anymore */
-	if (evictable_min_seq(min_seq, swappiness) + MIN_NR_GENS > max_seq)
-		return true;
-
 	/* run aging if the preferred type is exhausted */
 	if (min_seq[type] + MIN_NR_GENS > max_seq)
 		return true;
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.