diff options
Diffstat (limited to 'include/linux/page-flags.h')
| -rw-r--r-- | include/linux/page-flags.h | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 19724e6ebd26..f4ed4f1b0c77 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
| @@ -144,12 +144,12 @@ static inline struct page *compound_head(struct page *page) | |||
| 144 | return page; | 144 | return page; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | static inline int PageTail(struct page *page) | 147 | static __always_inline int PageTail(struct page *page) |
| 148 | { | 148 | { |
| 149 | return READ_ONCE(page->compound_head) & 1; | 149 | return READ_ONCE(page->compound_head) & 1; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | static inline int PageCompound(struct page *page) | 152 | static __always_inline int PageCompound(struct page *page) |
| 153 | { | 153 | { |
| 154 | return test_bit(PG_head, &page->flags) || PageTail(page); | 154 | return test_bit(PG_head, &page->flags) || PageTail(page); |
| 155 | } | 155 | } |
| @@ -184,31 +184,31 @@ static inline int PageCompound(struct page *page) | |||
| 184 | * Macros to create function definitions for page flags | 184 | * Macros to create function definitions for page flags |
| 185 | */ | 185 | */ |
| 186 | #define TESTPAGEFLAG(uname, lname, policy) \ | 186 | #define TESTPAGEFLAG(uname, lname, policy) \ |
| 187 | static inline int Page##uname(struct page *page) \ | 187 | static __always_inline int Page##uname(struct page *page) \ |
| 188 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } | 188 | { return test_bit(PG_##lname, &policy(page, 0)->flags); } |
| 189 | 189 | ||
| 190 | #define SETPAGEFLAG(uname, lname, policy) \ | 190 | #define SETPAGEFLAG(uname, lname, policy) \ |
| 191 | static inline void SetPage##uname(struct page *page) \ | 191 | static __always_inline void SetPage##uname(struct page *page) \ |
| 192 | { set_bit(PG_##lname, &policy(page, 1)->flags); } | 192 | { set_bit(PG_##lname, &policy(page, 1)->flags); } |
| 193 | 193 | ||
| 194 | #define CLEARPAGEFLAG(uname, lname, policy) \ | 194 | #define CLEARPAGEFLAG(uname, lname, policy) \ |
| 195 | static inline void ClearPage##uname(struct page *page) \ | 195 | static __always_inline void ClearPage##uname(struct page *page) \ |
| 196 | { clear_bit(PG_##lname, &policy(page, 1)->flags); } | 196 | { clear_bit(PG_##lname, &policy(page, 1)->flags); } |
| 197 | 197 | ||
| 198 | #define __SETPAGEFLAG(uname, lname, policy) \ | 198 | #define __SETPAGEFLAG(uname, lname, policy) \ |
| 199 | static inline void __SetPage##uname(struct page *page) \ | 199 | static __always_inline void __SetPage##uname(struct page *page) \ |
| 200 | { __set_bit(PG_##lname, &policy(page, 1)->flags); } | 200 | { __set_bit(PG_##lname, &policy(page, 1)->flags); } |
| 201 | 201 | ||
| 202 | #define __CLEARPAGEFLAG(uname, lname, policy) \ | 202 | #define __CLEARPAGEFLAG(uname, lname, policy) \ |
| 203 | static inline void __ClearPage##uname(struct page *page) \ | 203 | static __always_inline void __ClearPage##uname(struct page *page) \ |
| 204 | { __clear_bit(PG_##lname, &policy(page, 1)->flags); } | 204 | { __clear_bit(PG_##lname, &policy(page, 1)->flags); } |
| 205 | 205 | ||
| 206 | #define TESTSETFLAG(uname, lname, policy) \ | 206 | #define TESTSETFLAG(uname, lname, policy) \ |
| 207 | static inline int TestSetPage##uname(struct page *page) \ | 207 | static __always_inline int TestSetPage##uname(struct page *page) \ |
| 208 | { return test_and_set_bit(PG_##lname, &policy(page, 1)->flags); } | 208 | { return test_and_set_bit(PG_##lname, &policy(page, 1)->flags); } |
| 209 | 209 | ||
| 210 | #define TESTCLEARFLAG(uname, lname, policy) \ | 210 | #define TESTCLEARFLAG(uname, lname, policy) \ |
| 211 | static inline int TestClearPage##uname(struct page *page) \ | 211 | static __always_inline int TestClearPage##uname(struct page *page) \ |
| 212 | { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); } | 212 | { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); } |
| 213 | 213 | ||
| 214 | #define PAGEFLAG(uname, lname, policy) \ | 214 | #define PAGEFLAG(uname, lname, policy) \ |
| @@ -371,7 +371,7 @@ PAGEFLAG(Idle, idle, PF_ANY) | |||
| 371 | #define PAGE_MAPPING_KSM 2 | 371 | #define PAGE_MAPPING_KSM 2 |
| 372 | #define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM) | 372 | #define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM) |
| 373 | 373 | ||
| 374 | static inline int PageAnon(struct page *page) | 374 | static __always_inline int PageAnon(struct page *page) |
| 375 | { | 375 | { |
| 376 | page = compound_head(page); | 376 | page = compound_head(page); |
| 377 | return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; | 377 | return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; |
| @@ -384,7 +384,7 @@ static inline int PageAnon(struct page *page) | |||
| 384 | * is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any | 384 | * is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any |
| 385 | * anon_vma, but to that page's node of the stable tree. | 385 | * anon_vma, but to that page's node of the stable tree. |
| 386 | */ | 386 | */ |
| 387 | static inline int PageKsm(struct page *page) | 387 | static __always_inline int PageKsm(struct page *page) |
| 388 | { | 388 | { |
| 389 | page = compound_head(page); | 389 | page = compound_head(page); |
| 390 | return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) == | 390 | return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) == |
| @@ -415,14 +415,14 @@ static inline int PageUptodate(struct page *page) | |||
| 415 | return ret; | 415 | return ret; |
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | static inline void __SetPageUptodate(struct page *page) | 418 | static __always_inline void __SetPageUptodate(struct page *page) |
| 419 | { | 419 | { |
| 420 | VM_BUG_ON_PAGE(PageTail(page), page); | 420 | VM_BUG_ON_PAGE(PageTail(page), page); |
| 421 | smp_wmb(); | 421 | smp_wmb(); |
| 422 | __set_bit(PG_uptodate, &page->flags); | 422 | __set_bit(PG_uptodate, &page->flags); |
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | static inline void SetPageUptodate(struct page *page) | 425 | static __always_inline void SetPageUptodate(struct page *page) |
| 426 | { | 426 | { |
| 427 | VM_BUG_ON_PAGE(PageTail(page), page); | 427 | VM_BUG_ON_PAGE(PageTail(page), page); |
| 428 | /* | 428 | /* |
| @@ -456,12 +456,12 @@ static inline void set_page_writeback_keepwrite(struct page *page) | |||
| 456 | 456 | ||
| 457 | __PAGEFLAG(Head, head, PF_ANY) CLEARPAGEFLAG(Head, head, PF_ANY) | 457 | __PAGEFLAG(Head, head, PF_ANY) CLEARPAGEFLAG(Head, head, PF_ANY) |
| 458 | 458 | ||
| 459 | static inline void set_compound_head(struct page *page, struct page *head) | 459 | static __always_inline void set_compound_head(struct page *page, struct page *head) |
| 460 | { | 460 | { |
| 461 | WRITE_ONCE(page->compound_head, (unsigned long)head + 1); | 461 | WRITE_ONCE(page->compound_head, (unsigned long)head + 1); |
| 462 | } | 462 | } |
| 463 | 463 | ||
| 464 | static inline void clear_compound_head(struct page *page) | 464 | static __always_inline void clear_compound_head(struct page *page) |
| 465 | { | 465 | { |
| 466 | WRITE_ONCE(page->compound_head, 0); | 466 | WRITE_ONCE(page->compound_head, 0); |
| 467 | } | 467 | } |
| @@ -593,6 +593,8 @@ static inline void __ClearPageBuddy(struct page *page) | |||
| 593 | atomic_set(&page->_mapcount, -1); | 593 | atomic_set(&page->_mapcount, -1); |
| 594 | } | 594 | } |
| 595 | 595 | ||
| 596 | extern bool is_free_buddy_page(struct page *page); | ||
| 597 | |||
| 596 | #define PAGE_BALLOON_MAPCOUNT_VALUE (-256) | 598 | #define PAGE_BALLOON_MAPCOUNT_VALUE (-256) |
| 597 | 599 | ||
| 598 | static inline int PageBalloon(struct page *page) | 600 | static inline int PageBalloon(struct page *page) |
