diff options
Diffstat (limited to 'include/linux/mm_inline.h')
-rw-r--r-- | include/linux/mm_inline.h | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 96e970485b6c..2eb599465d56 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * page_is_file_cache - should the page be on a file LRU or anon LRU? | 5 | * page_is_file_cache - should the page be on a file LRU or anon LRU? |
6 | * @page: the page to test | 6 | * @page: the page to test |
7 | * | 7 | * |
8 | * Returns !0 if @page is page cache page backed by a regular filesystem, | 8 | * Returns LRU_FILE if @page is page cache page backed by a regular filesystem, |
9 | * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. | 9 | * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. |
10 | * Used by functions that manipulate the LRU lists, to sort a page | 10 | * Used by functions that manipulate the LRU lists, to sort a page |
11 | * onto the right LRU list. | 11 | * onto the right LRU list. |
@@ -20,7 +20,7 @@ static inline int page_is_file_cache(struct page *page) | |||
20 | return 0; | 20 | return 0; |
21 | 21 | ||
22 | /* The page is page cache backed by a normal filesystem. */ | 22 | /* The page is page cache backed by a normal filesystem. */ |
23 | return 1; | 23 | return LRU_FILE; |
24 | } | 24 | } |
25 | 25 | ||
26 | static inline void | 26 | static inline void |
@@ -38,39 +38,64 @@ del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l) | |||
38 | } | 38 | } |
39 | 39 | ||
40 | static inline void | 40 | static inline void |
41 | add_page_to_active_list(struct zone *zone, struct page *page) | 41 | add_page_to_inactive_anon_list(struct zone *zone, struct page *page) |
42 | { | 42 | { |
43 | add_page_to_lru_list(zone, page, LRU_ACTIVE); | 43 | add_page_to_lru_list(zone, page, LRU_INACTIVE_ANON); |
44 | } | 44 | } |
45 | 45 | ||
46 | static inline void | 46 | static inline void |
47 | add_page_to_inactive_list(struct zone *zone, struct page *page) | 47 | add_page_to_active_anon_list(struct zone *zone, struct page *page) |
48 | { | 48 | { |
49 | add_page_to_lru_list(zone, page, LRU_INACTIVE); | 49 | add_page_to_lru_list(zone, page, LRU_ACTIVE_ANON); |
50 | } | 50 | } |
51 | 51 | ||
52 | static inline void | 52 | static inline void |
53 | del_page_from_active_list(struct zone *zone, struct page *page) | 53 | add_page_to_inactive_file_list(struct zone *zone, struct page *page) |
54 | { | 54 | { |
55 | del_page_from_lru_list(zone, page, LRU_ACTIVE); | 55 | add_page_to_lru_list(zone, page, LRU_INACTIVE_FILE); |
56 | } | 56 | } |
57 | 57 | ||
58 | static inline void | 58 | static inline void |
59 | del_page_from_inactive_list(struct zone *zone, struct page *page) | 59 | add_page_to_active_file_list(struct zone *zone, struct page *page) |
60 | { | 60 | { |
61 | del_page_from_lru_list(zone, page, LRU_INACTIVE); | 61 | add_page_to_lru_list(zone, page, LRU_ACTIVE_FILE); |
62 | } | ||
63 | |||
64 | static inline void | ||
65 | del_page_from_inactive_anon_list(struct zone *zone, struct page *page) | ||
66 | { | ||
67 | del_page_from_lru_list(zone, page, LRU_INACTIVE_ANON); | ||
68 | } | ||
69 | |||
70 | static inline void | ||
71 | del_page_from_active_anon_list(struct zone *zone, struct page *page) | ||
72 | { | ||
73 | del_page_from_lru_list(zone, page, LRU_ACTIVE_ANON); | ||
74 | } | ||
75 | |||
76 | static inline void | ||
77 | del_page_from_inactive_file_list(struct zone *zone, struct page *page) | ||
78 | { | ||
79 | del_page_from_lru_list(zone, page, LRU_INACTIVE_FILE); | ||
80 | } | ||
81 | |||
82 | static inline void | ||
83 | del_page_from_active_file_list(struct zone *zone, struct page *page) | ||
84 | { | ||
85 | del_page_from_lru_list(zone, page, LRU_INACTIVE_FILE); | ||
62 | } | 86 | } |
63 | 87 | ||
64 | static inline void | 88 | static inline void |
65 | del_page_from_lru(struct zone *zone, struct page *page) | 89 | del_page_from_lru(struct zone *zone, struct page *page) |
66 | { | 90 | { |
67 | enum lru_list l = LRU_INACTIVE; | 91 | enum lru_list l = LRU_BASE; |
68 | 92 | ||
69 | list_del(&page->lru); | 93 | list_del(&page->lru); |
70 | if (PageActive(page)) { | 94 | if (PageActive(page)) { |
71 | __ClearPageActive(page); | 95 | __ClearPageActive(page); |
72 | l = LRU_ACTIVE; | 96 | l += LRU_ACTIVE; |
73 | } | 97 | } |
98 | l += page_is_file_cache(page); | ||
74 | __dec_zone_state(zone, NR_LRU_BASE + l); | 99 | __dec_zone_state(zone, NR_LRU_BASE + l); |
75 | } | 100 | } |
76 | 101 | ||
@@ -87,6 +112,7 @@ static inline enum lru_list page_lru(struct page *page) | |||
87 | 112 | ||
88 | if (PageActive(page)) | 113 | if (PageActive(page)) |
89 | lru += LRU_ACTIVE; | 114 | lru += LRU_ACTIVE; |
115 | lru += page_is_file_cache(page); | ||
90 | 116 | ||
91 | return lru; | 117 | return lru; |
92 | } | 118 | } |