diff options
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 7cf955feb823..294a67b94147 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -805,6 +805,24 @@ static inline void set_compound_order(struct page *page, unsigned int order) | |||
805 | page[1].compound_order = order; | 805 | page[1].compound_order = order; |
806 | } | 806 | } |
807 | 807 | ||
808 | /* Returns the number of pages in this potentially compound page. */ | ||
809 | static inline unsigned long compound_nr(struct page *page) | ||
810 | { | ||
811 | return 1UL << compound_order(page); | ||
812 | } | ||
813 | |||
814 | /* Returns the number of bytes in this potentially compound page. */ | ||
815 | static inline unsigned long page_size(struct page *page) | ||
816 | { | ||
817 | return PAGE_SIZE << compound_order(page); | ||
818 | } | ||
819 | |||
820 | /* Returns the number of bits needed for the number of bytes in a page */ | ||
821 | static inline unsigned int page_shift(struct page *page) | ||
822 | { | ||
823 | return PAGE_SHIFT + compound_order(page); | ||
824 | } | ||
825 | |||
808 | void free_compound_page(struct page *page); | 826 | void free_compound_page(struct page *page); |
809 | 827 | ||
810 | #ifdef CONFIG_MMU | 828 | #ifdef CONFIG_MMU |
@@ -1057,8 +1075,9 @@ static inline void put_user_page(struct page *page) | |||
1057 | put_page(page); | 1075 | put_page(page); |
1058 | } | 1076 | } |
1059 | 1077 | ||
1060 | void put_user_pages_dirty(struct page **pages, unsigned long npages); | 1078 | void put_user_pages_dirty_lock(struct page **pages, unsigned long npages, |
1061 | void put_user_pages_dirty_lock(struct page **pages, unsigned long npages); | 1079 | bool make_dirty); |
1080 | |||
1062 | void put_user_pages(struct page **pages, unsigned long npages); | 1081 | void put_user_pages(struct page **pages, unsigned long npages); |
1063 | 1082 | ||
1064 | #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) | 1083 | #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) |
@@ -1405,7 +1424,11 @@ extern void pagefault_out_of_memory(void); | |||
1405 | 1424 | ||
1406 | extern void show_free_areas(unsigned int flags, nodemask_t *nodemask); | 1425 | extern void show_free_areas(unsigned int flags, nodemask_t *nodemask); |
1407 | 1426 | ||
1427 | #ifdef CONFIG_MMU | ||
1408 | extern bool can_do_mlock(void); | 1428 | extern bool can_do_mlock(void); |
1429 | #else | ||
1430 | static inline bool can_do_mlock(void) { return false; } | ||
1431 | #endif | ||
1409 | extern int user_shm_lock(size_t, struct user_struct *); | 1432 | extern int user_shm_lock(size_t, struct user_struct *); |
1410 | extern void user_shm_unlock(size_t, struct user_struct *); | 1433 | extern void user_shm_unlock(size_t, struct user_struct *); |
1411 | 1434 | ||
@@ -2305,6 +2328,8 @@ extern int install_special_mapping(struct mm_struct *mm, | |||
2305 | unsigned long addr, unsigned long len, | 2328 | unsigned long addr, unsigned long len, |
2306 | unsigned long flags, struct page **pages); | 2329 | unsigned long flags, struct page **pages); |
2307 | 2330 | ||
2331 | unsigned long randomize_stack_top(unsigned long stack_top); | ||
2332 | |||
2308 | extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); | 2333 | extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); |
2309 | 2334 | ||
2310 | extern unsigned long mmap_region(struct file *file, unsigned long addr, | 2335 | extern unsigned long mmap_region(struct file *file, unsigned long addr, |
@@ -2568,6 +2593,7 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, | |||
2568 | #define FOLL_COW 0x4000 /* internal GUP flag */ | 2593 | #define FOLL_COW 0x4000 /* internal GUP flag */ |
2569 | #define FOLL_ANON 0x8000 /* don't do file mappings */ | 2594 | #define FOLL_ANON 0x8000 /* don't do file mappings */ |
2570 | #define FOLL_LONGTERM 0x10000 /* mapping lifetime is indefinite: see below */ | 2595 | #define FOLL_LONGTERM 0x10000 /* mapping lifetime is indefinite: see below */ |
2596 | #define FOLL_SPLIT_PMD 0x20000 /* split huge pmd before returning */ | ||
2571 | 2597 | ||
2572 | /* | 2598 | /* |
2573 | * NOTE on FOLL_LONGTERM: | 2599 | * NOTE on FOLL_LONGTERM: |
@@ -2845,5 +2871,12 @@ void __init setup_nr_node_ids(void); | |||
2845 | static inline void setup_nr_node_ids(void) {} | 2871 | static inline void setup_nr_node_ids(void) {} |
2846 | #endif | 2872 | #endif |
2847 | 2873 | ||
2874 | extern int memcmp_pages(struct page *page1, struct page *page2); | ||
2875 | |||
2876 | static inline int pages_identical(struct page *page1, struct page *page2) | ||
2877 | { | ||
2878 | return !memcmp_pages(page1, page2); | ||
2879 | } | ||
2880 | |||
2848 | #endif /* __KERNEL__ */ | 2881 | #endif /* __KERNEL__ */ |
2849 | #endif /* _LINUX_MM_H */ | 2882 | #endif /* _LINUX_MM_H */ |