aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2012-01-12 20:20:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-12 23:13:10 -0500
commit1c1c53d43b387d02174911ecb42ce846577b0ea0 (patch)
treebb1294b23d23f2403ab95068af6080b375cc3166
parent4111304dab198c687bc60f2e235a9f7ee92c47c8 (diff)
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: Hugh Dickins <hughd@google.com> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/mm_inline.h15
-rw-r--r--mm/swap.c4
2 files changed, 11 insertions, 8 deletions
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 8f84d2e53d0f..227fd3e9a9c9 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -54,8 +54,14 @@ static inline enum lru_list page_lru_base_type(struct page *page)
54 return LRU_INACTIVE_ANON; 54 return LRU_INACTIVE_ANON;
55} 55}
56 56
57static inline void 57/**
58del_page_from_lru(struct zone *zone, struct page *page) 58 * page_off_lru - which LRU list was page on? clearing its lru flags.
59 * @page: the page to test
60 *
61 * Returns the LRU list a page was on, as an index into the array of LRU
62 * lists; and clears its Unevictable or Active flags, ready for freeing.
63 */
64static inline enum lru_list page_off_lru(struct page *page)
59{ 65{
60 enum lru_list lru; 66 enum lru_list lru;
61 67
@@ -69,9 +75,7 @@ del_page_from_lru(struct zone *zone, struct page *page)
69 lru += LRU_ACTIVE; 75 lru += LRU_ACTIVE;
70 } 76 }
71 } 77 }
72 mem_cgroup_lru_del_list(page, lru); 78 return lru;
73 list_del(&page->lru);
74 __mod_zone_page_state(zone, NR_LRU_BASE + lru, -hpage_nr_pages(page));
75} 79}
76 80
77/** 81/**
@@ -92,7 +96,6 @@ static inline enum lru_list page_lru(struct page *page)
92 if (PageActive(page)) 96 if (PageActive(page))
93 lru += LRU_ACTIVE; 97 lru += LRU_ACTIVE;
94 } 98 }
95
96 return lru; 99 return lru;
97} 100}
98 101
diff --git a/mm/swap.c b/mm/swap.c
index 0d1b24b3fa87..b0f529b38979 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -53,7 +53,7 @@ static void __page_cache_release(struct page *page)
53 spin_lock_irqsave(&zone->lru_lock, flags); 53 spin_lock_irqsave(&zone->lru_lock, flags);
54 VM_BUG_ON(!PageLRU(page)); 54 VM_BUG_ON(!PageLRU(page));
55 __ClearPageLRU(page); 55 __ClearPageLRU(page);
56 del_page_from_lru(zone, page); 56 del_page_from_lru_list(zone, page, page_off_lru(page));
57 spin_unlock_irqrestore(&zone->lru_lock, flags); 57 spin_unlock_irqrestore(&zone->lru_lock, flags);
58 } 58 }
59} 59}
@@ -617,7 +617,7 @@ void release_pages(struct page **pages, int nr, int cold)
617 } 617 }
618 VM_BUG_ON(!PageLRU(page)); 618 VM_BUG_ON(!PageLRU(page));
619 __ClearPageLRU(page); 619 __ClearPageLRU(page);
620 del_page_from_lru(zone, page); 620 del_page_from_lru_list(zone, page, page_off_lru(page));
621 } 621 }
622 622
623 list_add(&page->lru, &pages_to_free); 623 list_add(&page->lru, &pages_to_free);