1 #ifndef _LINUX_MM_PAGE_IDLE_H 2 #define _LINUX_MM_PAGE_IDLE_H 3 4 #include <linux/bitops.h> 5 #include <linux/page-flags.h> 6 #include <linux/page_ext.h> 7 8 #ifdef CONFIG_IDLE_PAGE_TRACKING 9 10 #ifdef CONFIG_64BIT page_is_young(struct page * page)11static inline bool page_is_young(struct page *page) 12 { 13 return PageYoung(page); 14 } 15 set_page_young(struct page * page)16static inline void set_page_young(struct page *page) 17 { 18 SetPageYoung(page); 19 } 20 test_and_clear_page_young(struct page * page)21static inline bool test_and_clear_page_young(struct page *page) 22 { 23 return TestClearPageYoung(page); 24 } 25 page_is_idle(struct page * page)26static inline bool page_is_idle(struct page *page) 27 { 28 return PageIdle(page); 29 } 30 set_page_idle(struct page * page)31static inline void set_page_idle(struct page *page) 32 { 33 SetPageIdle(page); 34 } 35 clear_page_idle(struct page * page)36static inline void clear_page_idle(struct page *page) 37 { 38 ClearPageIdle(page); 39 } 40 #else /* !CONFIG_64BIT */ 41 /* 42 * If there is not enough space to store Idle and Young bits in page flags, use 43 * page ext flags instead. 44 */ 45 extern struct page_ext_operations page_idle_ops; 46 page_is_young(struct page * page)47static inline bool page_is_young(struct page *page) 48 { 49 return test_bit(PAGE_EXT_YOUNG, &lookup_page_ext(page)->flags); 50 } 51 set_page_young(struct page * page)52static inline void set_page_young(struct page *page) 53 { 54 set_bit(PAGE_EXT_YOUNG, &lookup_page_ext(page)->flags); 55 } 56 test_and_clear_page_young(struct page * page)57static inline bool test_and_clear_page_young(struct page *page) 58 { 59 return test_and_clear_bit(PAGE_EXT_YOUNG, 60 &lookup_page_ext(page)->flags); 61 } 62 page_is_idle(struct page * page)63static inline bool page_is_idle(struct page *page) 64 { 65 return test_bit(PAGE_EXT_IDLE, &lookup_page_ext(page)->flags); 66 } 67 set_page_idle(struct page * page)68static inline void set_page_idle(struct page *page) 69 { 70 set_bit(PAGE_EXT_IDLE, &lookup_page_ext(page)->flags); 71 } 72 clear_page_idle(struct page * page)73static inline void clear_page_idle(struct page *page) 74 { 75 clear_bit(PAGE_EXT_IDLE, &lookup_page_ext(page)->flags); 76 } 77 #endif /* CONFIG_64BIT */ 78 79 #else /* !CONFIG_IDLE_PAGE_TRACKING */ 80 page_is_young(struct page * page)81static inline bool page_is_young(struct page *page) 82 { 83 return false; 84 } 85 set_page_young(struct page * page)86static inline void set_page_young(struct page *page) 87 { 88 } 89 test_and_clear_page_young(struct page * page)90static inline bool test_and_clear_page_young(struct page *page) 91 { 92 return false; 93 } 94 page_is_idle(struct page * page)95static inline bool page_is_idle(struct page *page) 96 { 97 return false; 98 } 99 set_page_idle(struct page * page)100static inline void set_page_idle(struct page *page) 101 { 102 } 103 clear_page_idle(struct page * page)104static inline void clear_page_idle(struct page *page) 105 { 106 } 107 108 #endif /* CONFIG_IDLE_PAGE_TRACKING */ 109 110 #endif /* _LINUX_MM_PAGE_IDLE_H */ 111