diff options
Diffstat (limited to 'include/linux/mm.h')
| -rw-r--r-- | include/linux/mm.h | 67 |
1 files changed, 51 insertions, 16 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 2128ef7780c6..866a3dbe5c75 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -41,6 +41,9 @@ extern unsigned long mmap_min_addr; | |||
| 41 | 41 | ||
| 42 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) | 42 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) |
| 43 | 43 | ||
| 44 | /* to align the pointer to the (next) page boundary */ | ||
| 45 | #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) | ||
| 46 | |||
| 44 | /* | 47 | /* |
| 45 | * Linux kernel virtual memory manager primitives. | 48 | * Linux kernel virtual memory manager primitives. |
| 46 | * The idea being to have a "virtual" mm in the same way | 49 | * The idea being to have a "virtual" mm in the same way |
| @@ -100,6 +103,7 @@ extern unsigned int kobjsize(const void *objp); | |||
| 100 | #define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */ | 103 | #define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */ |
| 101 | #define VM_RESERVED 0x00080000 /* Count as reserved_vm like IO */ | 104 | #define VM_RESERVED 0x00080000 /* Count as reserved_vm like IO */ |
| 102 | #define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */ | 105 | #define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */ |
| 106 | #define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */ | ||
| 103 | #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ | 107 | #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ |
| 104 | #define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ | 108 | #define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ |
| 105 | #define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ | 109 | #define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ |
| @@ -166,12 +170,16 @@ struct vm_operations_struct { | |||
| 166 | void (*open)(struct vm_area_struct * area); | 170 | void (*open)(struct vm_area_struct * area); |
| 167 | void (*close)(struct vm_area_struct * area); | 171 | void (*close)(struct vm_area_struct * area); |
| 168 | int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); | 172 | int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); |
| 169 | unsigned long (*nopfn)(struct vm_area_struct *area, | ||
| 170 | unsigned long address); | ||
| 171 | 173 | ||
| 172 | /* notification that a previously read-only page is about to become | 174 | /* notification that a previously read-only page is about to become |
| 173 | * writable, if an error is returned it will cause a SIGBUS */ | 175 | * writable, if an error is returned it will cause a SIGBUS */ |
| 174 | int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page); | 176 | int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page); |
| 177 | |||
| 178 | /* called by access_process_vm when get_user_pages() fails, typically | ||
| 179 | * for use by special VMAs that can switch between memory and hardware | ||
| 180 | */ | ||
| 181 | int (*access)(struct vm_area_struct *vma, unsigned long addr, | ||
| 182 | void *buf, int len, int write); | ||
| 175 | #ifdef CONFIG_NUMA | 183 | #ifdef CONFIG_NUMA |
| 176 | /* | 184 | /* |
| 177 | * set_policy() op must add a reference to any non-NULL @new mempolicy | 185 | * set_policy() op must add a reference to any non-NULL @new mempolicy |
| @@ -675,13 +683,6 @@ static inline int page_mapped(struct page *page) | |||
| 675 | } | 683 | } |
| 676 | 684 | ||
| 677 | /* | 685 | /* |
| 678 | * Error return values for the *_nopfn functions | ||
| 679 | */ | ||
| 680 | #define NOPFN_SIGBUS ((unsigned long) -1) | ||
| 681 | #define NOPFN_OOM ((unsigned long) -2) | ||
| 682 | #define NOPFN_REFAULT ((unsigned long) -3) | ||
| 683 | |||
| 684 | /* | ||
| 685 | * Different kinds of faults, as returned by handle_mm_fault(). | 686 | * Different kinds of faults, as returned by handle_mm_fault(). |
| 686 | * Used to decide whether a process gets delivered SIGBUS or | 687 | * Used to decide whether a process gets delivered SIGBUS or |
| 687 | * just gets major/minor fault counters bumped up. | 688 | * just gets major/minor fault counters bumped up. |
| @@ -772,14 +773,14 @@ struct mm_walk { | |||
| 772 | 773 | ||
| 773 | int walk_page_range(unsigned long addr, unsigned long end, | 774 | int walk_page_range(unsigned long addr, unsigned long end, |
| 774 | struct mm_walk *walk); | 775 | struct mm_walk *walk); |
| 775 | void free_pgd_range(struct mmu_gather **tlb, unsigned long addr, | 776 | void free_pgd_range(struct mmu_gather *tlb, unsigned long addr, |
| 776 | unsigned long end, unsigned long floor, unsigned long ceiling); | 777 | unsigned long end, unsigned long floor, unsigned long ceiling); |
| 777 | void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *start_vma, | ||
| 778 | unsigned long floor, unsigned long ceiling); | ||
| 779 | int copy_page_range(struct mm_struct *dst, struct mm_struct *src, | 778 | int copy_page_range(struct mm_struct *dst, struct mm_struct *src, |
| 780 | struct vm_area_struct *vma); | 779 | struct vm_area_struct *vma); |
| 781 | void unmap_mapping_range(struct address_space *mapping, | 780 | void unmap_mapping_range(struct address_space *mapping, |
| 782 | loff_t const holebegin, loff_t const holelen, int even_cows); | 781 | loff_t const holebegin, loff_t const holelen, int even_cows); |
| 782 | int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, | ||
| 783 | void *buf, int len, int write); | ||
| 783 | 784 | ||
| 784 | static inline void unmap_shared_mapping_range(struct address_space *mapping, | 785 | static inline void unmap_shared_mapping_range(struct address_space *mapping, |
| 785 | loff_t const holebegin, loff_t const holelen) | 786 | loff_t const holebegin, loff_t const holelen) |
| @@ -809,7 +810,6 @@ extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void * | |||
| 809 | 810 | ||
| 810 | int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, | 811 | int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, |
| 811 | int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); | 812 | int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); |
| 812 | void print_bad_pte(struct vm_area_struct *, pte_t, unsigned long); | ||
| 813 | 813 | ||
| 814 | extern int try_to_release_page(struct page * page, gfp_t gfp_mask); | 814 | extern int try_to_release_page(struct page * page, gfp_t gfp_mask); |
| 815 | extern void do_invalidatepage(struct page *page, unsigned long offset); | 815 | extern void do_invalidatepage(struct page *page, unsigned long offset); |
| @@ -832,6 +832,39 @@ extern int mprotect_fixup(struct vm_area_struct *vma, | |||
| 832 | struct vm_area_struct **pprev, unsigned long start, | 832 | struct vm_area_struct **pprev, unsigned long start, |
| 833 | unsigned long end, unsigned long newflags); | 833 | unsigned long end, unsigned long newflags); |
| 834 | 834 | ||
| 835 | #ifdef CONFIG_HAVE_GET_USER_PAGES_FAST | ||
| 836 | /* | ||
| 837 | * get_user_pages_fast provides equivalent functionality to get_user_pages, | ||
| 838 | * operating on current and current->mm (force=0 and doesn't return any vmas). | ||
| 839 | * | ||
| 840 | * get_user_pages_fast may take mmap_sem and page tables, so no assumptions | ||
| 841 | * can be made about locking. get_user_pages_fast is to be implemented in a | ||
| 842 | * way that is advantageous (vs get_user_pages()) when the user memory area is | ||
| 843 | * already faulted in and present in ptes. However if the pages have to be | ||
| 844 | * faulted in, it may turn out to be slightly slower). | ||
| 845 | */ | ||
| 846 | int get_user_pages_fast(unsigned long start, int nr_pages, int write, | ||
| 847 | struct page **pages); | ||
| 848 | |||
| 849 | #else | ||
| 850 | /* | ||
| 851 | * Should probably be moved to asm-generic, and architectures can include it if | ||
| 852 | * they don't implement their own get_user_pages_fast. | ||
| 853 | */ | ||
| 854 | #define get_user_pages_fast(start, nr_pages, write, pages) \ | ||
| 855 | ({ \ | ||
| 856 | struct mm_struct *mm = current->mm; \ | ||
| 857 | int ret; \ | ||
| 858 | \ | ||
| 859 | down_read(&mm->mmap_sem); \ | ||
| 860 | ret = get_user_pages(current, mm, start, nr_pages, \ | ||
| 861 | write, 0, pages, NULL); \ | ||
| 862 | up_read(&mm->mmap_sem); \ | ||
| 863 | \ | ||
| 864 | ret; \ | ||
| 865 | }) | ||
| 866 | #endif | ||
| 867 | |||
| 835 | /* | 868 | /* |
| 836 | * A callback you can register to apply pressure to ageable caches. | 869 | * A callback you can register to apply pressure to ageable caches. |
| 837 | * | 870 | * |
| @@ -965,9 +998,8 @@ static inline void pgtable_page_dtor(struct page *page) | |||
| 965 | NULL: pte_offset_kernel(pmd, address)) | 998 | NULL: pte_offset_kernel(pmd, address)) |
| 966 | 999 | ||
| 967 | extern void free_area_init(unsigned long * zones_size); | 1000 | extern void free_area_init(unsigned long * zones_size); |
| 968 | extern void free_area_init_node(int nid, pg_data_t *pgdat, | 1001 | extern void free_area_init_node(int nid, unsigned long * zones_size, |
| 969 | unsigned long * zones_size, unsigned long zone_start_pfn, | 1002 | unsigned long zone_start_pfn, unsigned long *zholes_size); |
| 970 | unsigned long *zholes_size); | ||
| 971 | #ifdef CONFIG_ARCH_POPULATES_NODE_MAP | 1003 | #ifdef CONFIG_ARCH_POPULATES_NODE_MAP |
| 972 | /* | 1004 | /* |
| 973 | * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its | 1005 | * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its |
| @@ -1072,6 +1104,9 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **, | |||
| 1072 | unsigned long addr, unsigned long len, pgoff_t pgoff); | 1104 | unsigned long addr, unsigned long len, pgoff_t pgoff); |
| 1073 | extern void exit_mmap(struct mm_struct *); | 1105 | extern void exit_mmap(struct mm_struct *); |
| 1074 | 1106 | ||
| 1107 | extern int mm_take_all_locks(struct mm_struct *mm); | ||
| 1108 | extern void mm_drop_all_locks(struct mm_struct *mm); | ||
| 1109 | |||
| 1075 | #ifdef CONFIG_PROC_FS | 1110 | #ifdef CONFIG_PROC_FS |
| 1076 | /* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */ | 1111 | /* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */ |
| 1077 | extern void added_exe_file_vma(struct mm_struct *mm); | 1112 | extern void added_exe_file_vma(struct mm_struct *mm); |
