crypto: atmel-sha - remove unnecessary static in atmel_sha_remove()
[linux-stable.git] / include / linux / page_idle.h
blobfec40271339f8044aa1e3f1743e62017f146f9cc
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 struct page_ext *page_ext = lookup_page_ext(page);
51 if (unlikely(!page_ext))
52 return false;
54 return test_bit(PAGE_EXT_YOUNG, &page_ext->flags);
57 static inline void set_page_young(struct page *page)
59 struct page_ext *page_ext = lookup_page_ext(page);
61 if (unlikely(!page_ext))
62 return;
64 set_bit(PAGE_EXT_YOUNG, &page_ext->flags);
67 static inline bool test_and_clear_page_young(struct page *page)
69 struct page_ext *page_ext = lookup_page_ext(page);
71 if (unlikely(!page_ext))
72 return false;
74 return test_and_clear_bit(PAGE_EXT_YOUNG, &page_ext->flags);
77 static inline bool page_is_idle(struct page *page)
79 struct page_ext *page_ext = lookup_page_ext(page);
81 if (unlikely(!page_ext))
82 return false;
84 return test_bit(PAGE_EXT_IDLE, &page_ext->flags);
87 static inline void set_page_idle(struct page *page)
89 struct page_ext *page_ext = lookup_page_ext(page);
91 if (unlikely(!page_ext))
92 return;
94 set_bit(PAGE_EXT_IDLE, &page_ext->flags);
97 static inline void clear_page_idle(struct page *page)
99 struct page_ext *page_ext = lookup_page_ext(page);
101 if (unlikely(!page_ext))
102 return;
104 clear_bit(PAGE_EXT_IDLE, &page_ext->flags);
106 #endif /* CONFIG_64BIT */
108 #else /* !CONFIG_IDLE_PAGE_TRACKING */
110 static inline bool page_is_young(struct page *page)
112 return false;
115 static inline void set_page_young(struct page *page)
119 static inline bool test_and_clear_page_young(struct page *page)
121 return false;
124 static inline bool page_is_idle(struct page *page)
126 return false;
129 static inline void set_page_idle(struct page *page)
133 static inline void clear_page_idle(struct page *page)
137 #endif /* CONFIG_IDLE_PAGE_TRACKING */
139 #endif /* _LINUX_MM_PAGE_IDLE_H */