1#ifndef LINUX_MM_INLINE_H
2#define LINUX_MM_INLINE_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17static inline int page_is_file_cache(struct page *page)
18{
19 if (PageSwapBacked(page))
20 return 0;
21
22
23 return LRU_FILE;
24}
25
26static inline void
27add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l)
28{
29 list_add(&page->lru, &zone->lru[l].list);
30 __inc_zone_state(zone, NR_LRU_BASE + l);
31}
32
33static inline void
34del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
35{
36 list_del(&page->lru);
37 __dec_zone_state(zone, NR_LRU_BASE + l);
38}
39
40static inline void
41del_page_from_lru(struct zone *zone, struct page *page)
42{
43 enum lru_list l = LRU_BASE;
44
45 list_del(&page->lru);
46 if (PageUnevictable(page)) {
47 __ClearPageUnevictable(page);
48 l = LRU_UNEVICTABLE;
49 } else {
50 if (PageActive(page)) {
51 __ClearPageActive(page);
52 l += LRU_ACTIVE;
53 }
54 l += page_is_file_cache(page);
55 }
56 __dec_zone_state(zone, NR_LRU_BASE + l);
57}
58
59
60
61
62
63
64
65
66static inline enum lru_list page_lru(struct page *page)
67{
68 enum lru_list lru = LRU_BASE;
69
70 if (PageUnevictable(page))
71 lru = LRU_UNEVICTABLE;
72 else {
73 if (PageActive(page))
74 lru += LRU_ACTIVE;
75 lru += page_is_file_cache(page);
76 }
77
78 return lru;
79}
80
81
82
83
84
85
86
87
88static inline int inactive_anon_is_low(struct zone *zone)
89{
90 unsigned long active, inactive;
91
92 active = zone_page_state(zone, NR_ACTIVE_ANON);
93 inactive = zone_page_state(zone, NR_INACTIVE_ANON);
94
95 if (inactive * zone->inactive_ratio < active)
96 return 1;
97
98 return 0;
99}
100#endif
101