vmscan: Use an indexed array for LRU variables
[deliverable/linux.git] / include / linux / mm_inline.h
1 static inline void
2 add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l)
3 {
4 list_add(&page->lru, &zone->lru[l].list);
5 __inc_zone_state(zone, NR_LRU_BASE + l);
6 }
7
8 static inline void
9 del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
10 {
11 list_del(&page->lru);
12 __dec_zone_state(zone, NR_LRU_BASE + l);
13 }
14
15 static inline void
16 add_page_to_active_list(struct zone *zone, struct page *page)
17 {
18 add_page_to_lru_list(zone, page, LRU_ACTIVE);
19 }
20
21 static inline void
22 add_page_to_inactive_list(struct zone *zone, struct page *page)
23 {
24 add_page_to_lru_list(zone, page, LRU_INACTIVE);
25 }
26
27 static inline void
28 del_page_from_active_list(struct zone *zone, struct page *page)
29 {
30 del_page_from_lru_list(zone, page, LRU_ACTIVE);
31 }
32
33 static inline void
34 del_page_from_inactive_list(struct zone *zone, struct page *page)
35 {
36 del_page_from_lru_list(zone, page, LRU_INACTIVE);
37 }
38
39 static inline void
40 del_page_from_lru(struct zone *zone, struct page *page)
41 {
42 enum lru_list l = LRU_INACTIVE;
43
44 list_del(&page->lru);
45 if (PageActive(page)) {
46 __ClearPageActive(page);
47 l = LRU_ACTIVE;
48 }
49 __dec_zone_state(zone, NR_LRU_BASE + l);
50 }
51
52 /**
53 * page_lru - which LRU list should a page be on?
54 * @page: the page to test
55 *
56 * Returns the LRU list a page should be on, as an index
57 * into the array of LRU lists.
58 */
59 static inline enum lru_list page_lru(struct page *page)
60 {
61 enum lru_list lru = LRU_BASE;
62
63 if (PageActive(page))
64 lru += LRU_ACTIVE;
65
66 return lru;
67 }
This page took 0.040058 seconds and 5 git commands to generate.