diff options
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 3b337efbe533..c0a67b894c4c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/bit_spinlock.h> | 19 | #include <linux/bit_spinlock.h> |
20 | #include <linux/shrinker.h> | 20 | #include <linux/shrinker.h> |
21 | #include <linux/resource.h> | 21 | #include <linux/resource.h> |
22 | #include <linux/page_ext.h> | ||
22 | 23 | ||
23 | struct mempolicy; | 24 | struct mempolicy; |
24 | struct anon_vma; | 25 | struct anon_vma; |
@@ -2060,7 +2061,22 @@ static inline void vm_stat_account(struct mm_struct *mm, | |||
2060 | #endif /* CONFIG_PROC_FS */ | 2061 | #endif /* CONFIG_PROC_FS */ |
2061 | 2062 | ||
2062 | #ifdef CONFIG_DEBUG_PAGEALLOC | 2063 | #ifdef CONFIG_DEBUG_PAGEALLOC |
2063 | extern void kernel_map_pages(struct page *page, int numpages, int enable); | 2064 | extern bool _debug_pagealloc_enabled; |
2065 | extern void __kernel_map_pages(struct page *page, int numpages, int enable); | ||
2066 | |||
2067 | static inline bool debug_pagealloc_enabled(void) | ||
2068 | { | ||
2069 | return _debug_pagealloc_enabled; | ||
2070 | } | ||
2071 | |||
2072 | static inline void | ||
2073 | kernel_map_pages(struct page *page, int numpages, int enable) | ||
2074 | { | ||
2075 | if (!debug_pagealloc_enabled()) | ||
2076 | return; | ||
2077 | |||
2078 | __kernel_map_pages(page, numpages, enable); | ||
2079 | } | ||
2064 | #ifdef CONFIG_HIBERNATION | 2080 | #ifdef CONFIG_HIBERNATION |
2065 | extern bool kernel_page_present(struct page *page); | 2081 | extern bool kernel_page_present(struct page *page); |
2066 | #endif /* CONFIG_HIBERNATION */ | 2082 | #endif /* CONFIG_HIBERNATION */ |
@@ -2094,9 +2110,9 @@ int drop_caches_sysctl_handler(struct ctl_table *, int, | |||
2094 | void __user *, size_t *, loff_t *); | 2110 | void __user *, size_t *, loff_t *); |
2095 | #endif | 2111 | #endif |
2096 | 2112 | ||
2097 | unsigned long shrink_slab(struct shrink_control *shrink, | 2113 | unsigned long shrink_node_slabs(gfp_t gfp_mask, int nid, |
2098 | unsigned long nr_pages_scanned, | 2114 | unsigned long nr_scanned, |
2099 | unsigned long lru_pages); | 2115 | unsigned long nr_eligible); |
2100 | 2116 | ||
2101 | #ifndef CONFIG_MMU | 2117 | #ifndef CONFIG_MMU |
2102 | #define randomize_va_space 0 | 2118 | #define randomize_va_space 0 |
@@ -2155,20 +2171,36 @@ extern void copy_user_huge_page(struct page *dst, struct page *src, | |||
2155 | unsigned int pages_per_huge_page); | 2171 | unsigned int pages_per_huge_page); |
2156 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ | 2172 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ |
2157 | 2173 | ||
2174 | extern struct page_ext_operations debug_guardpage_ops; | ||
2175 | extern struct page_ext_operations page_poisoning_ops; | ||
2176 | |||
2158 | #ifdef CONFIG_DEBUG_PAGEALLOC | 2177 | #ifdef CONFIG_DEBUG_PAGEALLOC |
2159 | extern unsigned int _debug_guardpage_minorder; | 2178 | extern unsigned int _debug_guardpage_minorder; |
2179 | extern bool _debug_guardpage_enabled; | ||
2160 | 2180 | ||
2161 | static inline unsigned int debug_guardpage_minorder(void) | 2181 | static inline unsigned int debug_guardpage_minorder(void) |
2162 | { | 2182 | { |
2163 | return _debug_guardpage_minorder; | 2183 | return _debug_guardpage_minorder; |
2164 | } | 2184 | } |
2165 | 2185 | ||
2186 | static inline bool debug_guardpage_enabled(void) | ||
2187 | { | ||
2188 | return _debug_guardpage_enabled; | ||
2189 | } | ||
2190 | |||
2166 | static inline bool page_is_guard(struct page *page) | 2191 | static inline bool page_is_guard(struct page *page) |
2167 | { | 2192 | { |
2168 | return test_bit(PAGE_DEBUG_FLAG_GUARD, &page->debug_flags); | 2193 | struct page_ext *page_ext; |
2194 | |||
2195 | if (!debug_guardpage_enabled()) | ||
2196 | return false; | ||
2197 | |||
2198 | page_ext = lookup_page_ext(page); | ||
2199 | return test_bit(PAGE_EXT_DEBUG_GUARD, &page_ext->flags); | ||
2169 | } | 2200 | } |
2170 | #else | 2201 | #else |
2171 | static inline unsigned int debug_guardpage_minorder(void) { return 0; } | 2202 | static inline unsigned int debug_guardpage_minorder(void) { return 0; } |
2203 | static inline bool debug_guardpage_enabled(void) { return false; } | ||
2172 | static inline bool page_is_guard(struct page *page) { return false; } | 2204 | static inline bool page_is_guard(struct page *page) { return false; } |
2173 | #endif /* CONFIG_DEBUG_PAGEALLOC */ | 2205 | #endif /* CONFIG_DEBUG_PAGEALLOC */ |
2174 | 2206 | ||