8 #include <linux/types.h>
11 #ifndef __GENERATING_BOUNDS_H
13 #include <generated/bounds.h>
89 #ifdef CONFIG_PAGEFLAGS_EXTENDED
103 #ifdef CONFIG_ARCH_USES_PG_UNCACHED
106 #ifdef CONFIG_MEMORY_FAILURE
109 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
131 #ifndef __GENERATING_BOUNDS_H
136 #define TESTPAGEFLAG(uname, lname) \
137 static inline int Page##uname(const struct page *page) \
138 { return test_bit(PG_##lname, &page->flags); }
140 #define SETPAGEFLAG(uname, lname) \
141 static inline void SetPage##uname(struct page *page) \
142 { set_bit(PG_##lname, &page->flags); }
144 #define CLEARPAGEFLAG(uname, lname) \
145 static inline void ClearPage##uname(struct page *page) \
146 { clear_bit(PG_##lname, &page->flags); }
148 #define __SETPAGEFLAG(uname, lname) \
149 static inline void __SetPage##uname(struct page *page) \
150 { __set_bit(PG_##lname, &page->flags); }
152 #define __CLEARPAGEFLAG(uname, lname) \
153 static inline void __ClearPage##uname(struct page *page) \
154 { __clear_bit(PG_##lname, &page->flags); }
156 #define TESTSETFLAG(uname, lname) \
157 static inline int TestSetPage##uname(struct page *page) \
158 { return test_and_set_bit(PG_##lname, &page->flags); }
160 #define TESTCLEARFLAG(uname, lname) \
161 static inline int TestClearPage##uname(struct page *page) \
162 { return test_and_clear_bit(PG_##lname, &page->flags); }
164 #define __TESTCLEARFLAG(uname, lname) \
165 static inline int __TestClearPage##uname(struct page *page) \
166 { return __test_and_clear_bit(PG_##lname, &page->flags); }
168 #define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
169 SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname)
171 #define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
172 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname)
174 #define PAGEFLAG_FALSE(uname) \
175 static inline int Page##uname(const struct page *page) \
178 #define TESTSCFLAG(uname, lname) \
179 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname)
181 #define SETPAGEFLAG_NOOP(uname) \
182 static inline void SetPage##uname(struct page *page) { }
184 #define CLEARPAGEFLAG_NOOP(uname) \
185 static inline void ClearPage##uname(struct page *page) { }
187 #define __CLEARPAGEFLAG_NOOP(uname) \
188 static inline void __ClearPage##uname(struct page *page) { }
190 #define TESTCLEARFLAG_FALSE(uname) \
191 static inline int TestClearPage##uname(struct page *page) { return 0; }
193 #define __TESTCLEARFLAG_FALSE(uname) \
194 static inline int __TestClearPage##uname(struct page *page) { return 0; }
229 PAGEFLAG(MappedToDisk, mappedtodisk)
235 #ifdef CONFIG_HIGHMEM
240 #define PageHighMem(__p) is_highmem(page_zone(__p))
263 #ifdef CONFIG_ARCH_USES_PG_UNCACHED
269 #ifdef CONFIG_MEMORY_FAILURE
272 #define __PG_HWPOISON (1UL << PG_hwpoison)
275 #define __PG_HWPOISON 0
280 static inline int PageUptodate(
struct page *
page)
298 static inline void __SetPageUptodate(
struct page *page)
304 static inline void SetPageUptodate(
struct page *page)
330 static
inline void set_page_writeback(
struct page *page)
335 #ifdef CONFIG_PAGEFLAGS_EXTENDED
347 return page->flags & ((1
L << PG_head) | (1L << PG_tail));
350 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
351 static inline void ClearPageCompound(
struct page *page)
377 #define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim))
379 static inline int PageTail(
struct page *page)
384 static inline void __SetPageTail(
struct page *page)
389 static inline void __ClearPageTail(
struct page *page)
394 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
395 static inline void ClearPageCompound(
struct page *page)
404 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
413 static inline int PageTransHuge(
struct page *page)
416 return PageHead(page);
424 static inline int PageTransCompound(
struct page *page)
426 return PageCompound(page);
434 static inline int PageTransTail(
struct page *page)
436 return PageTail(page);
441 static inline int PageTransHuge(
struct page *page)
446 static inline int PageTransCompound(
struct page *page)
451 static inline int PageTransTail(
struct page *page)
461 static inline int PageSlabPfmemalloc(
struct page *page)
464 return PageActive(page);
467 static inline void SetPageSlabPfmemalloc(
struct page *page)
473 static inline void __ClearPageSlabPfmemalloc(
struct page *page)
476 __ClearPageActive(page);
479 static inline void ClearPageSlabPfmemalloc(
struct page *page)
482 ClearPageActive(page);
486 #define __PG_MLOCKED (1 << PG_mlocked)
488 #define __PG_MLOCKED 0
491 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
492 #define __PG_COMPOUND_LOCK (1 << PG_compound_lock)
494 #define __PG_COMPOUND_LOCK 0
501 #define PAGE_FLAGS_CHECK_AT_FREE \
502 (1 << PG_lru | 1 << PG_locked | \
503 1 << PG_private | 1 << PG_private_2 | \
504 1 << PG_writeback | 1 << PG_reserved | \
505 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
506 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON | \
514 #define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1)
516 #define PAGE_FLAGS_PRIVATE \
517 (1 << PG_private | 1 << PG_private_2)
525 static inline int page_has_private(
struct page *page)