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
11 static inline bool page_is_young(struct page
*page
)
13 return PageYoung(page
);
16 static inline void set_page_young(struct page
*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
)
36 static inline void clear_page_idle(struct page
*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
))
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
))
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
))
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
))
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
))
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
))
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
)
115 static inline void set_page_young(struct page
*page
)
119 static inline bool test_and_clear_page_young(struct page
*page
)
124 static inline bool page_is_idle(struct page
*page
)
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 */