Linux 4.6-rc6
[cris-mirror.git] / include / linux / page_idle.h
blobbf268fa92c5b34a1bffce97a8cd38acf2b161059
1 #ifndef _LINUX_MM_PAGE_IDLE_H
2 #define _LINUX_MM_PAGE_IDLE_H
4 #include <linux/bitops.h>
5 #include <linux/page-flags.h>
6 #include <linux/page_ext.h>
8 #ifdef CONFIG_IDLE_PAGE_TRACKING
10 #ifdef CONFIG_64BIT
11 static inline bool page_is_young(struct page *page)
13 return PageYoung(page);
16 static inline void set_page_young(struct page *page)
18 SetPageYoung(page);
21 static inline bool test_and_clear_page_young(struct page *page)
23 return TestClearPageYoung(page);
26 static inline bool page_is_idle(struct page *page)
28 return PageIdle(page);
31 static inline void set_page_idle(struct page *page)
33 SetPageIdle(page);
36 static inline void clear_page_idle(struct page *page)
38 ClearPageIdle(page);
40 #else /* !CONFIG_64BIT */
42 * If there is not enough space to store Idle and Young bits in page flags, use
43 * page ext flags instead.
45 extern struct page_ext_operations page_idle_ops;
47 static inline bool page_is_young(struct page *page)
49 return test_bit(PAGE_EXT_YOUNG, &lookup_page_ext(page)->flags);
52 static inline void set_page_young(struct page *page)
54 set_bit(PAGE_EXT_YOUNG, &lookup_page_ext(page)->flags);
57 static inline bool test_and_clear_page_young(struct page *page)
59 return test_and_clear_bit(PAGE_EXT_YOUNG,
60 &lookup_page_ext(page)->flags);
63 static inline bool page_is_idle(struct page *page)
65 return test_bit(PAGE_EXT_IDLE, &lookup_page_ext(page)->flags);
68 static inline void set_page_idle(struct page *page)
70 set_bit(PAGE_EXT_IDLE, &lookup_page_ext(page)->flags);
73 static inline void clear_page_idle(struct page *page)
75 clear_bit(PAGE_EXT_IDLE, &lookup_page_ext(page)->flags);
77 #endif /* CONFIG_64BIT */
79 #else /* !CONFIG_IDLE_PAGE_TRACKING */
81 static inline bool page_is_young(struct page *page)
83 return false;
86 static inline void set_page_young(struct page *page)
90 static inline bool test_and_clear_page_young(struct page *page)
92 return false;
95 static inline bool page_is_idle(struct page *page)
97 return false;
100 static inline void set_page_idle(struct page *page)
104 static inline void clear_page_idle(struct page *page)
108 #endif /* CONFIG_IDLE_PAGE_TRACKING */
110 #endif /* _LINUX_MM_PAGE_IDLE_H */