lru_list lru bit 0 can tell whether the list is
avtive lru-list or not.
lru_list lru bit 1 can tell whether the list is
file lru-list or not.

And fix some define type in shrink_active_list()
and get_scan_count().

v1->v2:
correct the commit message, and fix the define type.

Signed-off-by: Hui Su <sh_...@163.com>
---
 include/linux/mmzone.h | 4 ++--
 mm/vmscan.c            | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index fb3bf696c05e..294369c652d0 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -258,12 +258,12 @@ enum lru_list {
 
 static inline bool is_file_lru(enum lru_list lru)
 {
-       return (lru == LRU_INACTIVE_FILE || lru == LRU_ACTIVE_FILE);
+       return lru & LRU_FILE;
 }
 
 static inline bool is_active_lru(enum lru_list lru)
 {
-       return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE);
+       return lru & LRU_ACTIVE;
 }
 
 #define ANON_AND_FILE 2
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 7b4e31eac2cf..7d8ea2fc87fc 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2020,7 +2020,7 @@ static void shrink_active_list(unsigned long nr_to_scan,
        struct page *page;
        unsigned nr_deactivate, nr_activate;
        unsigned nr_rotated = 0;
-       int file = is_file_lru(lru);
+       bool file = is_file_lru(lru);
        struct pglist_data *pgdat = lruvec_pgdat(lruvec);
 
        lru_add_drain();
@@ -2323,7 +2323,7 @@ static void get_scan_count(struct lruvec *lruvec, struct 
scan_control *sc,
        denominator = ap + fp;
 out:
        for_each_evictable_lru(lru) {
-               int file = is_file_lru(lru);
+               bool file = is_file_lru(lru);
                unsigned long lruvec_size;
                unsigned long scan;
                unsigned long protection;
-- 
2.29.0


Reply via email to