printf: Remove unused 'bprintf'
[drm/drm-misc.git] / include / linux / page_idle.h
blob89ca0d5dc1e71d4552ae956ebbd43e64fdb0dc3a
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_MM_PAGE_IDLE_H
3 #define _LINUX_MM_PAGE_IDLE_H
5 #include <linux/bitops.h>
6 #include <linux/page-flags.h>
7 #include <linux/page_ext.h>
9 #if defined(CONFIG_PAGE_IDLE_FLAG) && !defined(CONFIG_64BIT)
11 * If there is not enough space to store Idle and Young bits in page flags, use
12 * page ext flags instead.
14 static inline bool folio_test_young(const struct folio *folio)
16 struct page_ext *page_ext = page_ext_get(&folio->page);
17 bool page_young;
19 if (unlikely(!page_ext))
20 return false;
22 page_young = test_bit(PAGE_EXT_YOUNG, &page_ext->flags);
23 page_ext_put(page_ext);
25 return page_young;
28 static inline void folio_set_young(struct folio *folio)
30 struct page_ext *page_ext = page_ext_get(&folio->page);
32 if (unlikely(!page_ext))
33 return;
35 set_bit(PAGE_EXT_YOUNG, &page_ext->flags);
36 page_ext_put(page_ext);
39 static inline bool folio_test_clear_young(struct folio *folio)
41 struct page_ext *page_ext = page_ext_get(&folio->page);
42 bool page_young;
44 if (unlikely(!page_ext))
45 return false;
47 page_young = test_and_clear_bit(PAGE_EXT_YOUNG, &page_ext->flags);
48 page_ext_put(page_ext);
50 return page_young;
53 static inline bool folio_test_idle(const struct folio *folio)
55 struct page_ext *page_ext = page_ext_get(&folio->page);
56 bool page_idle;
58 if (unlikely(!page_ext))
59 return false;
61 page_idle = test_bit(PAGE_EXT_IDLE, &page_ext->flags);
62 page_ext_put(page_ext);
64 return page_idle;
67 static inline void folio_set_idle(struct folio *folio)
69 struct page_ext *page_ext = page_ext_get(&folio->page);
71 if (unlikely(!page_ext))
72 return;
74 set_bit(PAGE_EXT_IDLE, &page_ext->flags);
75 page_ext_put(page_ext);
78 static inline void folio_clear_idle(struct folio *folio)
80 struct page_ext *page_ext = page_ext_get(&folio->page);
82 if (unlikely(!page_ext))
83 return;
85 clear_bit(PAGE_EXT_IDLE, &page_ext->flags);
86 page_ext_put(page_ext);
88 #endif /* CONFIG_PAGE_IDLE_FLAG && !64BIT */
89 #endif /* _LINUX_MM_PAGE_IDLE_H */