| Linux kernel & device driver programming |
| [ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] |
1 static inline void !! 1 #ifndef LINUX_MM_INLINE_H
2 add_page_to_active_list(struct zone *zone, str !! 2 #define LINUX_MM_INLINE_H
3 { <<
4 list_add(&page->lru, &zone->active_lis <<
5 __inc_zone_state(zone, NR_ACTIVE); <<
6 } <<
7 3
8 static inline void !! 4 /**
9 add_page_to_inactive_list(struct zone *zone, s !! 5 * page_is_file_cache - should the page be on a file LRU or anon LRU?
>> 6 * @page: the page to test
>> 7 *
>> 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.
>> 10 * Used by functions that manipulate the LRU lists, to sort a page
>> 11 * onto the right LRU list.
>> 12 *
>> 13 * We would like to get this info without a page flag, but the state
>> 14 * needs to survive until the page is last deleted from the LRU, which
>> 15 * could be as far down as __page_cache_release.
>> 16 */
>> 17 static inline int page_is_file_cache(struct page *page)
10 { 18 {
11 list_add(&page->lru, &zone->inactive_l !! 19 if (PageSwapBacked(page))
12 __inc_zone_state(zone, NR_INACTIVE); !! 20 return 0;
>> 21
>> 22 /* The page is page cache backed by a normal filesystem. */
>> 23 return LRU_FILE;
13 } 24 }
14 25
15 static inline void 26 static inline void
16 del_page_from_active_list(struct zone *zone, s !! 27 add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l)
17 { 28 {
18 list_del(&page->lru); !! 29 list_add(&page->lru, &zone->lru[l].list);
19 __dec_zone_state(zone, NR_ACTIVE); !! 30 __inc_zone_state(zone, NR_LRU_BASE + l);
>> 31 mem_cgroup_add_lru_list(page, l);
20 } 32 }
21 33
22 static inline void 34 static inline void
23 del_page_from_inactive_list(struct zone *zone, !! 35 del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
24 { 36 {
25 list_del(&page->lru); 37 list_del(&page->lru);
26 __dec_zone_state(zone, NR_INACTIVE); !! 38 __dec_zone_state(zone, NR_LRU_BASE + l);
>> 39 mem_cgroup_del_lru_list(page, l);
27 } 40 }
28 41
29 static inline void 42 static inline void
30 del_page_from_lru(struct zone *zone, struct pa 43 del_page_from_lru(struct zone *zone, struct page *page)
31 { 44 {
>> 45 enum lru_list l = LRU_BASE;
>> 46
32 list_del(&page->lru); 47 list_del(&page->lru);
33 if (PageActive(page)) { !! 48 if (PageUnevictable(page)) {
34 __ClearPageActive(page); !! 49 __ClearPageUnevictable(page);
35 __dec_zone_state(zone, NR_ACTI !! 50 l = LRU_UNEVICTABLE;
36 } else { 51 } else {
37 __dec_zone_state(zone, NR_INAC !! 52 if (PageActive(page)) {
>> 53 __ClearPageActive(page);
>> 54 l += LRU_ACTIVE;
>> 55 }
>> 56 l += page_is_file_cache(page);
38 } 57 }
>> 58 __dec_zone_state(zone, NR_LRU_BASE + l);
>> 59 mem_cgroup_del_lru_list(page, l);
>> 60 }
>> 61
>> 62 /**
>> 63 * page_lru - which LRU list should a page be on?
>> 64 * @page: the page to test
>> 65 *
>> 66 * Returns the LRU list a page should be on, as an index
>> 67 * into the array of LRU lists.
>> 68 */
>> 69 static inline enum lru_list page_lru(struct page *page)
>> 70 {
>> 71 enum lru_list lru = LRU_BASE;
>> 72
>> 73 if (PageUnevictable(page))
>> 74 lru = LRU_UNEVICTABLE;
>> 75 else {
>> 76 if (PageActive(page))
>> 77 lru += LRU_ACTIVE;
>> 78 lru += page_is_file_cache(page);
>> 79 }
>> 80
>> 81 return lru;
39 } 82 }
40 83
>> 84 #endif
41 85
| This page was automatically generated by the LXR engine. |