mm: use self-explanatory macros rather than "2"
authorYu Zhao <yuzhao@google.com>
Fri, 16 Oct 2020 03:09:55 +0000 (20:09 -0700)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 17 Jan 2024 17:15:53 +0000 (18:15 +0100)
Change-Id: Ia0efe80fa2c62163b0d58a382aef1e0881cba15b
Signed-off-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Alex Shi <alex.shi@linux.alibaba.com>
Link: http://lkml.kernel.org/r/20200831175042.3527153-2-yuzhao@google.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[backport of the commit ed0173733dd468883198c3136284394320b8fad6 from mainline]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
include/linux/mmzone.h
include/linux/vmstat.h
mm/vmscan.c

index e88b2fd..a0b59ae 100644 (file)
@@ -282,6 +282,8 @@ static inline bool is_active_lru(enum lru_list lru)
        return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE);
 }
 
+#define ANON_AND_FILE 2
+
 struct zone_reclaim_stat {
        /*
         * The pageout code in vmscan.c keeps track of how many of the
@@ -429,6 +431,8 @@ enum zone_type {
 
 #ifndef __GENERATING_BOUNDS_H
 
+#define ASYNC_AND_SYNC 2
+
 struct zone {
        /* Read-mostly fields */
 
@@ -548,8 +552,8 @@ struct zone {
 #if defined CONFIG_COMPACTION || defined CONFIG_CMA
        /* pfn where compaction free scanner should start */
        unsigned long           compact_cached_free_pfn;
-       /* pfn where async and sync compaction migration scanner should start */
-       unsigned long           compact_cached_migrate_pfn[2];
+       /* pfn where compaction migration scanner should start */
+       unsigned long           compact_cached_migrate_pfn[ASYNC_AND_SYNC];
        unsigned long           compact_init_migrate_pfn;
        unsigned long           compact_init_free_pfn;
 #endif
index bdeda4b..53c69a0 100644 (file)
@@ -26,7 +26,7 @@ struct reclaim_stat {
        unsigned nr_congested;
        unsigned nr_writeback;
        unsigned nr_immediate;
-       unsigned nr_activate[2];
+       unsigned nr_activate[ANON_AND_FILE];
        unsigned nr_ref_keep;
        unsigned nr_unmap_fail;
 };
index b589866..efe221d 100644 (file)
@@ -2248,7 +2248,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
        struct mem_cgroup *memcg = lruvec_memcg(lruvec);
        int swappiness = mem_cgroup_swappiness(memcg);
        struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
-       u64 fraction[2];
+       u64 fraction[ANON_AND_FILE];
        u64 denominator = 0;    /* gcc */
        struct pglist_data *pgdat = lruvec_pgdat(lruvec);
        unsigned long anon_prio, file_prio;