Commit 1c1c53d4 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

mm: remove del_page_from_lru, add page_off_lru

del_page_from_lru() repeats del_page_from_lru_list(), also working out
which LRU the page was on, clearing the relevant bits.  Decouple those
functions: remove del_page_from_lru() and add page_off_lru().
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 4111304d
...@@ -54,8 +54,14 @@ static inline enum lru_list page_lru_base_type(struct page *page) ...@@ -54,8 +54,14 @@ static inline enum lru_list page_lru_base_type(struct page *page)
return LRU_INACTIVE_ANON; return LRU_INACTIVE_ANON;
} }
static inline void /**
del_page_from_lru(struct zone *zone, struct page *page) * page_off_lru - which LRU list was page on? clearing its lru flags.
* @page: the page to test
*
* Returns the LRU list a page was on, as an index into the array of LRU
* lists; and clears its Unevictable or Active flags, ready for freeing.
*/
static inline enum lru_list page_off_lru(struct page *page)
{ {
enum lru_list lru; enum lru_list lru;
...@@ -69,9 +75,7 @@ del_page_from_lru(struct zone *zone, struct page *page) ...@@ -69,9 +75,7 @@ del_page_from_lru(struct zone *zone, struct page *page)
lru += LRU_ACTIVE; lru += LRU_ACTIVE;
} }
} }
mem_cgroup_lru_del_list(page, lru); return lru;
list_del(&page->lru);
__mod_zone_page_state(zone, NR_LRU_BASE + lru, -hpage_nr_pages(page));
} }
/** /**
...@@ -92,7 +96,6 @@ static inline enum lru_list page_lru(struct page *page) ...@@ -92,7 +96,6 @@ static inline enum lru_list page_lru(struct page *page)
if (PageActive(page)) if (PageActive(page))
lru += LRU_ACTIVE; lru += LRU_ACTIVE;
} }
return lru; return lru;
} }
......
...@@ -53,7 +53,7 @@ static void __page_cache_release(struct page *page) ...@@ -53,7 +53,7 @@ static void __page_cache_release(struct page *page)
spin_lock_irqsave(&zone->lru_lock, flags); spin_lock_irqsave(&zone->lru_lock, flags);
VM_BUG_ON(!PageLRU(page)); VM_BUG_ON(!PageLRU(page));
__ClearPageLRU(page); __ClearPageLRU(page);
del_page_from_lru(zone, page); del_page_from_lru_list(zone, page, page_off_lru(page));
spin_unlock_irqrestore(&zone->lru_lock, flags); spin_unlock_irqrestore(&zone->lru_lock, flags);
} }
} }
...@@ -617,7 +617,7 @@ void release_pages(struct page **pages, int nr, int cold) ...@@ -617,7 +617,7 @@ void release_pages(struct page **pages, int nr, int cold)
} }
VM_BUG_ON(!PageLRU(page)); VM_BUG_ON(!PageLRU(page));
__ClearPageLRU(page); __ClearPageLRU(page);
del_page_from_lru(zone, page); del_page_from_lru_list(zone, page, page_off_lru(page));
} }
list_add(&page->lru, &pages_to_free); list_add(&page->lru, &pages_to_free);
......
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