Commit ed017373 authored by Yu Zhao's avatar Yu Zhao Committed by Linus Torvalds

mm: use self-explanatory macros rather than "2"

Signed-off-by: default avatarYu Zhao <yuzhao@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Alex Shi <alex.shi@linux.alibaba.com>
Link: http://lkml.kernel.org/r/20200831175042.3527153-2-yuzhao@google.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 955cc774
...@@ -266,6 +266,8 @@ static inline bool is_active_lru(enum lru_list lru) ...@@ -266,6 +266,8 @@ static inline bool is_active_lru(enum lru_list lru)
return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE); return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE);
} }
#define ANON_AND_FILE 2
enum lruvec_flags { enum lruvec_flags {
LRUVEC_CONGESTED, /* lruvec has many dirty pages LRUVEC_CONGESTED, /* lruvec has many dirty pages
* backed by a congested BDI * backed by a congested BDI
...@@ -283,8 +285,8 @@ struct lruvec { ...@@ -283,8 +285,8 @@ struct lruvec {
unsigned long file_cost; unsigned long file_cost;
/* Non-resident age, driven by LRU movement */ /* Non-resident age, driven by LRU movement */
atomic_long_t nonresident_age; atomic_long_t nonresident_age;
/* Refaults at the time of last reclaim cycle, anon=0, file=1 */ /* Refaults at the time of last reclaim cycle */
unsigned long refaults[2]; unsigned long refaults[ANON_AND_FILE];
/* Various lruvec state flags (enum lruvec_flags) */ /* Various lruvec state flags (enum lruvec_flags) */
unsigned long flags; unsigned long flags;
#ifdef CONFIG_MEMCG #ifdef CONFIG_MEMCG
...@@ -441,6 +443,8 @@ enum zone_type { ...@@ -441,6 +443,8 @@ enum zone_type {
#ifndef __GENERATING_BOUNDS_H #ifndef __GENERATING_BOUNDS_H
#define ASYNC_AND_SYNC 2
struct zone { struct zone {
/* Read-mostly fields */ /* Read-mostly fields */
...@@ -560,8 +564,8 @@ struct zone { ...@@ -560,8 +564,8 @@ struct zone {
#if defined CONFIG_COMPACTION || defined CONFIG_CMA #if defined CONFIG_COMPACTION || defined CONFIG_CMA
/* pfn where compaction free scanner should start */ /* pfn where compaction free scanner should start */
unsigned long compact_cached_free_pfn; unsigned long compact_cached_free_pfn;
/* pfn where async and sync compaction migration scanner should start */ /* pfn where compaction migration scanner should start */
unsigned long compact_cached_migrate_pfn[2]; unsigned long compact_cached_migrate_pfn[ASYNC_AND_SYNC];
unsigned long compact_init_migrate_pfn; unsigned long compact_init_migrate_pfn;
unsigned long compact_init_free_pfn; unsigned long compact_init_free_pfn;
#endif #endif
......
...@@ -28,7 +28,7 @@ struct reclaim_stat { ...@@ -28,7 +28,7 @@ struct reclaim_stat {
unsigned nr_writeback; unsigned nr_writeback;
unsigned nr_immediate; unsigned nr_immediate;
unsigned nr_pageout; unsigned nr_pageout;
unsigned nr_activate[2]; unsigned nr_activate[ANON_AND_FILE];
unsigned nr_ref_keep; unsigned nr_ref_keep;
unsigned nr_unmap_fail; unsigned nr_unmap_fail;
unsigned nr_lazyfree_fail; unsigned nr_lazyfree_fail;
......
...@@ -2239,7 +2239,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, ...@@ -2239,7 +2239,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
struct mem_cgroup *memcg = lruvec_memcg(lruvec); struct mem_cgroup *memcg = lruvec_memcg(lruvec);
unsigned long anon_cost, file_cost, total_cost; unsigned long anon_cost, file_cost, total_cost;
int swappiness = mem_cgroup_swappiness(memcg); int swappiness = mem_cgroup_swappiness(memcg);
u64 fraction[2]; u64 fraction[ANON_AND_FILE];
u64 denominator = 0; /* gcc */ u64 denominator = 0; /* gcc */
enum scan_balance scan_balance; enum scan_balance scan_balance;
unsigned long ap, fp; unsigned long ap, fp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment