Commit 4111304d authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

mm: enum lru_list lru

Mostly we use "enum lru_list lru": change those few "l"s to "lru"s.
Signed-off-by: default avatarHugh Dickins <hughd@google.com>
Reviewed-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4d06f382
...@@ -22,21 +22,21 @@ static inline int page_is_file_cache(struct page *page) ...@@ -22,21 +22,21 @@ static inline int page_is_file_cache(struct page *page)
} }
static inline void static inline void
add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l) add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list lru)
{ {
struct lruvec *lruvec; struct lruvec *lruvec;
lruvec = mem_cgroup_lru_add_list(zone, page, l); lruvec = mem_cgroup_lru_add_list(zone, page, lru);
list_add(&page->lru, &lruvec->lists[l]); list_add(&page->lru, &lruvec->lists[lru]);
__mod_zone_page_state(zone, NR_LRU_BASE + l, hpage_nr_pages(page)); __mod_zone_page_state(zone, NR_LRU_BASE + lru, hpage_nr_pages(page));
} }
static inline void static inline void
del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l) del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list lru)
{ {
mem_cgroup_lru_del_list(page, l); mem_cgroup_lru_del_list(page, lru);
list_del(&page->lru); list_del(&page->lru);
__mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page)); __mod_zone_page_state(zone, NR_LRU_BASE + lru, -hpage_nr_pages(page));
} }
/** /**
...@@ -57,21 +57,21 @@ static inline enum lru_list page_lru_base_type(struct page *page) ...@@ -57,21 +57,21 @@ static inline enum lru_list page_lru_base_type(struct page *page)
static inline void static inline void
del_page_from_lru(struct zone *zone, struct page *page) del_page_from_lru(struct zone *zone, struct page *page)
{ {
enum lru_list l; enum lru_list lru;
if (PageUnevictable(page)) { if (PageUnevictable(page)) {
__ClearPageUnevictable(page); __ClearPageUnevictable(page);
l = LRU_UNEVICTABLE; lru = LRU_UNEVICTABLE;
} else { } else {
l = page_lru_base_type(page); lru = page_lru_base_type(page);
if (PageActive(page)) { if (PageActive(page)) {
__ClearPageActive(page); __ClearPageActive(page);
l += LRU_ACTIVE; lru += LRU_ACTIVE;
} }
} }
mem_cgroup_lru_del_list(page, l); mem_cgroup_lru_del_list(page, lru);
list_del(&page->lru); list_del(&page->lru);
__mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page)); __mod_zone_page_state(zone, NR_LRU_BASE + lru, -hpage_nr_pages(page));
} }
/** /**
......
...@@ -140,23 +140,23 @@ enum lru_list { ...@@ -140,23 +140,23 @@ enum lru_list {
NR_LRU_LISTS NR_LRU_LISTS
}; };
#define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++) #define for_each_lru(lru) for (lru = 0; lru < NR_LRU_LISTS; lru++)
#define for_each_evictable_lru(l) for (l = 0; l <= LRU_ACTIVE_FILE; l++) #define for_each_evictable_lru(lru) for (lru = 0; lru <= LRU_ACTIVE_FILE; lru++)
static inline int is_file_lru(enum lru_list l) static inline int is_file_lru(enum lru_list lru)
{ {
return (l == LRU_INACTIVE_FILE || l == LRU_ACTIVE_FILE); return (lru == LRU_INACTIVE_FILE || lru == LRU_ACTIVE_FILE);
} }
static inline int is_active_lru(enum lru_list l) static inline int is_active_lru(enum lru_list lru)
{ {
return (l == LRU_ACTIVE_ANON || l == LRU_ACTIVE_FILE); return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE);
} }
static inline int is_unevictable_lru(enum lru_list l) static inline int is_unevictable_lru(enum lru_list lru)
{ {
return (l == LRU_UNEVICTABLE); return (lru == LRU_UNEVICTABLE);
} }
struct lruvec { struct lruvec {
......
...@@ -4262,7 +4262,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat, ...@@ -4262,7 +4262,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
for (j = 0; j < MAX_NR_ZONES; j++) { for (j = 0; j < MAX_NR_ZONES; j++) {
struct zone *zone = pgdat->node_zones + j; struct zone *zone = pgdat->node_zones + j;
unsigned long size, realsize, memmap_pages; unsigned long size, realsize, memmap_pages;
enum lru_list l; enum lru_list lru;
size = zone_spanned_pages_in_node(nid, j, zones_size); size = zone_spanned_pages_in_node(nid, j, zones_size);
realsize = size - zone_absent_pages_in_node(nid, j, realsize = size - zone_absent_pages_in_node(nid, j,
...@@ -4312,8 +4312,8 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat, ...@@ -4312,8 +4312,8 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
zone->zone_pgdat = pgdat; zone->zone_pgdat = pgdat;
zone_pcp_init(zone); zone_pcp_init(zone);
for_each_lru(l) for_each_lru(lru)
INIT_LIST_HEAD(&zone->lruvec.lists[l]); INIT_LIST_HEAD(&zone->lruvec.lists[lru]);
zone->reclaim_stat.recent_rotated[0] = 0; zone->reclaim_stat.recent_rotated[0] = 0;
zone->reclaim_stat.recent_rotated[1] = 0; zone->reclaim_stat.recent_rotated[1] = 0;
zone->reclaim_stat.recent_scanned[0] = 0; zone->reclaim_stat.recent_scanned[0] = 0;
......
...@@ -1920,7 +1920,7 @@ static void get_scan_count(struct mem_cgroup_zone *mz, struct scan_control *sc, ...@@ -1920,7 +1920,7 @@ static void get_scan_count(struct mem_cgroup_zone *mz, struct scan_control *sc,
unsigned long ap, fp; unsigned long ap, fp;
struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(mz); struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(mz);
u64 fraction[2], denominator; u64 fraction[2], denominator;
enum lru_list l; enum lru_list lru;
int noswap = 0; int noswap = 0;
bool force_scan = false; bool force_scan = false;
...@@ -2010,18 +2010,18 @@ static void get_scan_count(struct mem_cgroup_zone *mz, struct scan_control *sc, ...@@ -2010,18 +2010,18 @@ static void get_scan_count(struct mem_cgroup_zone *mz, struct scan_control *sc,
fraction[1] = fp; fraction[1] = fp;
denominator = ap + fp + 1; denominator = ap + fp + 1;
out: out:
for_each_evictable_lru(l) { for_each_evictable_lru(lru) {
int file = is_file_lru(l); int file = is_file_lru(lru);
unsigned long scan; unsigned long scan;
scan = zone_nr_lru_pages(mz, l); scan = zone_nr_lru_pages(mz, lru);
if (priority || noswap) { if (priority || noswap) {
scan >>= priority; scan >>= priority;
if (!scan && force_scan) if (!scan && force_scan)
scan = SWAP_CLUSTER_MAX; scan = SWAP_CLUSTER_MAX;
scan = div64_u64(scan * fraction[file], denominator); scan = div64_u64(scan * fraction[file], denominator);
} }
nr[l] = scan; nr[lru] = scan;
} }
} }
...@@ -2097,7 +2097,7 @@ static void shrink_mem_cgroup_zone(int priority, struct mem_cgroup_zone *mz, ...@@ -2097,7 +2097,7 @@ static void shrink_mem_cgroup_zone(int priority, struct mem_cgroup_zone *mz,
{ {
unsigned long nr[NR_LRU_LISTS]; unsigned long nr[NR_LRU_LISTS];
unsigned long nr_to_scan; unsigned long nr_to_scan;
enum lru_list l; enum lru_list lru;
unsigned long nr_reclaimed, nr_scanned; unsigned long nr_reclaimed, nr_scanned;
unsigned long nr_to_reclaim = sc->nr_to_reclaim; unsigned long nr_to_reclaim = sc->nr_to_reclaim;
struct blk_plug plug; struct blk_plug plug;
...@@ -2110,13 +2110,13 @@ static void shrink_mem_cgroup_zone(int priority, struct mem_cgroup_zone *mz, ...@@ -2110,13 +2110,13 @@ static void shrink_mem_cgroup_zone(int priority, struct mem_cgroup_zone *mz,
blk_start_plug(&plug); blk_start_plug(&plug);
while (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] || while (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] ||
nr[LRU_INACTIVE_FILE]) { nr[LRU_INACTIVE_FILE]) {
for_each_evictable_lru(l) { for_each_evictable_lru(lru) {
if (nr[l]) { if (nr[lru]) {
nr_to_scan = min_t(unsigned long, nr_to_scan = min_t(unsigned long,
nr[l], SWAP_CLUSTER_MAX); nr[lru], SWAP_CLUSTER_MAX);
nr[l] -= nr_to_scan; nr[lru] -= nr_to_scan;
nr_reclaimed += shrink_list(l, nr_to_scan, nr_reclaimed += shrink_list(lru, nr_to_scan,
mz, sc, priority); mz, sc, priority);
} }
} }
......
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