0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef PAGEBLOCK_FLAGS_H
0012 #define PAGEBLOCK_FLAGS_H
0013
0014 #include <linux/types.h>
0015
0016 #define PB_migratetype_bits 3
0017
0018 enum pageblock_bits {
0019 PB_migrate,
0020 PB_migrate_end = PB_migrate + PB_migratetype_bits - 1,
0021
0022 PB_migrate_skip,
0023
0024
0025
0026
0027
0028 NR_PAGEBLOCK_BITS
0029 };
0030
0031 #ifdef CONFIG_HUGETLB_PAGE
0032
0033 #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
0034
0035
0036 extern unsigned int pageblock_order;
0037
0038 #else
0039
0040
0041
0042
0043
0044 #define pageblock_order min_t(unsigned int, HUGETLB_PAGE_ORDER, MAX_ORDER - 1)
0045
0046 #endif
0047
0048 #else
0049
0050
0051 #define pageblock_order (MAX_ORDER-1)
0052
0053 #endif
0054
0055 #define pageblock_nr_pages (1UL << pageblock_order)
0056
0057
0058 struct page;
0059
0060 unsigned long get_pfnblock_flags_mask(const struct page *page,
0061 unsigned long pfn,
0062 unsigned long mask);
0063
0064 void set_pfnblock_flags_mask(struct page *page,
0065 unsigned long flags,
0066 unsigned long pfn,
0067 unsigned long mask);
0068
0069
0070 #ifdef CONFIG_COMPACTION
0071 #define get_pageblock_skip(page) \
0072 get_pfnblock_flags_mask(page, page_to_pfn(page), \
0073 (1 << (PB_migrate_skip)))
0074 #define clear_pageblock_skip(page) \
0075 set_pfnblock_flags_mask(page, 0, page_to_pfn(page), \
0076 (1 << PB_migrate_skip))
0077 #define set_pageblock_skip(page) \
0078 set_pfnblock_flags_mask(page, (1 << PB_migrate_skip), \
0079 page_to_pfn(page), \
0080 (1 << PB_migrate_skip))
0081 #else
0082 static inline bool get_pageblock_skip(struct page *page)
0083 {
0084 return false;
0085 }
0086 static inline void clear_pageblock_skip(struct page *page)
0087 {
0088 }
0089 static inline void set_pageblock_skip(struct page *page)
0090 {
0091 }
0092 #endif
0093
0094 #endif