diff options
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 9a72cc78e6b8..24c395694f4d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -25,6 +25,7 @@ extern unsigned long max_mapnr; | |||
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | extern unsigned long num_physpages; | 27 | extern unsigned long num_physpages; |
28 | extern unsigned long totalram_pages; | ||
28 | extern void * high_memory; | 29 | extern void * high_memory; |
29 | extern int page_cluster; | 30 | extern int page_cluster; |
30 | 31 | ||
@@ -103,6 +104,7 @@ extern unsigned int kobjsize(const void *objp); | |||
103 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ | 104 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ |
104 | #define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ | 105 | #define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ |
105 | #define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */ | 106 | #define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */ |
107 | #define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */ | ||
106 | 108 | ||
107 | #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ | 109 | #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ |
108 | #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS | 110 | #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS |
@@ -283,6 +285,14 @@ static inline int is_vmalloc_addr(const void *x) | |||
283 | return 0; | 285 | return 0; |
284 | #endif | 286 | #endif |
285 | } | 287 | } |
288 | #ifdef CONFIG_MMU | ||
289 | extern int is_vmalloc_or_module_addr(const void *x); | ||
290 | #else | ||
291 | static inline int is_vmalloc_or_module_addr(const void *x) | ||
292 | { | ||
293 | return 0; | ||
294 | } | ||
295 | #endif | ||
286 | 296 | ||
287 | static inline struct page *compound_head(struct page *page) | 297 | static inline struct page *compound_head(struct page *page) |
288 | { | 298 | { |
@@ -685,11 +695,12 @@ static inline int page_mapped(struct page *page) | |||
685 | #define VM_FAULT_SIGBUS 0x0002 | 695 | #define VM_FAULT_SIGBUS 0x0002 |
686 | #define VM_FAULT_MAJOR 0x0004 | 696 | #define VM_FAULT_MAJOR 0x0004 |
687 | #define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */ | 697 | #define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */ |
698 | #define VM_FAULT_HWPOISON 0x0010 /* Hit poisoned page */ | ||
688 | 699 | ||
689 | #define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */ | 700 | #define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */ |
690 | #define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */ | 701 | #define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */ |
691 | 702 | ||
692 | #define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS) | 703 | #define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON) |
693 | 704 | ||
694 | /* | 705 | /* |
695 | * Can be called by the pagefault handler when it gets a VM_FAULT_OOM. | 706 | * Can be called by the pagefault handler when it gets a VM_FAULT_OOM. |
@@ -700,17 +711,8 @@ extern void pagefault_out_of_memory(void); | |||
700 | 711 | ||
701 | extern void show_free_areas(void); | 712 | extern void show_free_areas(void); |
702 | 713 | ||
703 | #ifdef CONFIG_SHMEM | 714 | int shmem_lock(struct file *file, int lock, struct user_struct *user); |
704 | extern int shmem_lock(struct file *file, int lock, struct user_struct *user); | ||
705 | #else | ||
706 | static inline int shmem_lock(struct file *file, int lock, | ||
707 | struct user_struct *user) | ||
708 | { | ||
709 | return 0; | ||
710 | } | ||
711 | #endif | ||
712 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); | 715 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); |
713 | |||
714 | int shmem_zero_setup(struct vm_area_struct *); | 716 | int shmem_zero_setup(struct vm_area_struct *); |
715 | 717 | ||
716 | #ifndef CONFIG_MMU | 718 | #ifndef CONFIG_MMU |
@@ -790,8 +792,14 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping, | |||
790 | unmap_mapping_range(mapping, holebegin, holelen, 0); | 792 | unmap_mapping_range(mapping, holebegin, holelen, 0); |
791 | } | 793 | } |
792 | 794 | ||
793 | extern int vmtruncate(struct inode * inode, loff_t offset); | 795 | extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); |
794 | extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end); | 796 | extern int vmtruncate(struct inode *inode, loff_t offset); |
797 | extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end); | ||
798 | |||
799 | int truncate_inode_page(struct address_space *mapping, struct page *page); | ||
800 | int generic_error_remove_page(struct address_space *mapping, struct page *page); | ||
801 | |||
802 | int invalidate_inode_page(struct page *page); | ||
795 | 803 | ||
796 | #ifdef CONFIG_MMU | 804 | #ifdef CONFIG_MMU |
797 | extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, | 805 | extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
@@ -815,6 +823,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
815 | struct page **pages, struct vm_area_struct **vmas); | 823 | struct page **pages, struct vm_area_struct **vmas); |
816 | int get_user_pages_fast(unsigned long start, int nr_pages, int write, | 824 | int get_user_pages_fast(unsigned long start, int nr_pages, int write, |
817 | struct page **pages); | 825 | struct page **pages); |
826 | struct page *get_dump_page(unsigned long addr); | ||
818 | 827 | ||
819 | extern int try_to_release_page(struct page * page, gfp_t gfp_mask); | 828 | extern int try_to_release_page(struct page * page, gfp_t gfp_mask); |
820 | extern void do_invalidatepage(struct page *page, unsigned long offset); | 829 | extern void do_invalidatepage(struct page *page, unsigned long offset); |
@@ -1058,6 +1067,8 @@ extern void setup_per_cpu_pageset(void); | |||
1058 | static inline void setup_per_cpu_pageset(void) {} | 1067 | static inline void setup_per_cpu_pageset(void) {} |
1059 | #endif | 1068 | #endif |
1060 | 1069 | ||
1070 | extern void zone_pcp_update(struct zone *zone); | ||
1071 | |||
1061 | /* nommu.c */ | 1072 | /* nommu.c */ |
1062 | extern atomic_long_t mmap_pages_allocated; | 1073 | extern atomic_long_t mmap_pages_allocated; |
1063 | 1074 | ||
@@ -1226,7 +1237,8 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address, | |||
1226 | #define FOLL_WRITE 0x01 /* check pte is writable */ | 1237 | #define FOLL_WRITE 0x01 /* check pte is writable */ |
1227 | #define FOLL_TOUCH 0x02 /* mark page accessed */ | 1238 | #define FOLL_TOUCH 0x02 /* mark page accessed */ |
1228 | #define FOLL_GET 0x04 /* do get_page on page */ | 1239 | #define FOLL_GET 0x04 /* do get_page on page */ |
1229 | #define FOLL_ANON 0x08 /* give ZERO_PAGE if no pgtable */ | 1240 | #define FOLL_DUMP 0x08 /* give error on hole if it would be zero */ |
1241 | #define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */ | ||
1230 | 1242 | ||
1231 | typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, | 1243 | typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, |
1232 | void *data); | 1244 | void *data); |
@@ -1274,7 +1286,7 @@ int in_gate_area_no_task(unsigned long addr); | |||
1274 | #define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) | 1286 | #define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) |
1275 | #endif /* __HAVE_ARCH_GATE_AREA */ | 1287 | #endif /* __HAVE_ARCH_GATE_AREA */ |
1276 | 1288 | ||
1277 | int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, | 1289 | int drop_caches_sysctl_handler(struct ctl_table *, int, |
1278 | void __user *, size_t *, loff_t *); | 1290 | void __user *, size_t *, loff_t *); |
1279 | unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, | 1291 | unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, |
1280 | unsigned long lru_pages); | 1292 | unsigned long lru_pages); |
@@ -1303,5 +1315,12 @@ void vmemmap_populate_print_last(void); | |||
1303 | extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim, | 1315 | extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim, |
1304 | size_t size); | 1316 | size_t size); |
1305 | extern void refund_locked_memory(struct mm_struct *mm, size_t size); | 1317 | extern void refund_locked_memory(struct mm_struct *mm, size_t size); |
1318 | |||
1319 | extern void memory_failure(unsigned long pfn, int trapno); | ||
1320 | extern int __memory_failure(unsigned long pfn, int trapno, int ref); | ||
1321 | extern int sysctl_memory_failure_early_kill; | ||
1322 | extern int sysctl_memory_failure_recovery; | ||
1323 | extern atomic_long_t mce_bad_pages; | ||
1324 | |||
1306 | #endif /* __KERNEL__ */ | 1325 | #endif /* __KERNEL__ */ |
1307 | #endif /* _LINUX_MM_H */ | 1326 | #endif /* _LINUX_MM_H */ |