0001
0002 #ifndef __LINUX_PAGE_EXT_H
0003 #define __LINUX_PAGE_EXT_H
0004
0005 #include <linux/types.h>
0006 #include <linux/stacktrace.h>
0007 #include <linux/stackdepot.h>
0008
0009 struct pglist_data;
0010 struct page_ext_operations {
0011 size_t offset;
0012 size_t size;
0013 bool (*need)(void);
0014 void (*init)(void);
0015 };
0016
0017 #ifdef CONFIG_PAGE_EXTENSION
0018
0019 enum page_ext_flags {
0020 PAGE_EXT_OWNER,
0021 PAGE_EXT_OWNER_ALLOCATED,
0022 #if defined(CONFIG_PAGE_IDLE_FLAG) && !defined(CONFIG_64BIT)
0023 PAGE_EXT_YOUNG,
0024 PAGE_EXT_IDLE,
0025 #endif
0026 };
0027
0028
0029
0030
0031
0032
0033
0034
0035 struct page_ext {
0036 unsigned long flags;
0037 };
0038
0039 extern unsigned long page_ext_size;
0040 extern void pgdat_page_ext_init(struct pglist_data *pgdat);
0041
0042 #ifdef CONFIG_SPARSEMEM
0043 static inline void page_ext_init_flatmem(void)
0044 {
0045 }
0046 extern void page_ext_init(void);
0047 static inline void page_ext_init_flatmem_late(void)
0048 {
0049 }
0050 #else
0051 extern void page_ext_init_flatmem(void);
0052 extern void page_ext_init_flatmem_late(void);
0053 static inline void page_ext_init(void)
0054 {
0055 }
0056 #endif
0057
0058 struct page_ext *lookup_page_ext(const struct page *page);
0059
0060 static inline struct page_ext *page_ext_next(struct page_ext *curr)
0061 {
0062 void *next = curr;
0063 next += page_ext_size;
0064 return next;
0065 }
0066
0067 #else
0068 struct page_ext;
0069
0070 static inline void pgdat_page_ext_init(struct pglist_data *pgdat)
0071 {
0072 }
0073
0074 static inline struct page_ext *lookup_page_ext(const struct page *page)
0075 {
0076 return NULL;
0077 }
0078
0079 static inline void page_ext_init(void)
0080 {
0081 }
0082
0083 static inline void page_ext_init_flatmem_late(void)
0084 {
0085 }
0086
0087 static inline void page_ext_init_flatmem(void)
0088 {
0089 }
0090 #endif
0091 #endif