diff options
Diffstat (limited to 'include/linux/mm.h')
| -rw-r--r-- | include/linux/mm.h | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index f6385fc17ad4..294104e0891d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -151,6 +151,7 @@ extern pgprot_t protection_map[16]; | |||
| 151 | #define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */ | 151 | #define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */ |
| 152 | #define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */ | 152 | #define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */ |
| 153 | #define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */ | 153 | #define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */ |
| 154 | #define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */ | ||
| 154 | 155 | ||
| 155 | /* | 156 | /* |
| 156 | * This interface is used by x86 PAT code to identify a pfn mapping that is | 157 | * This interface is used by x86 PAT code to identify a pfn mapping that is |
| @@ -402,16 +403,23 @@ static inline void init_page_count(struct page *page) | |||
| 402 | /* | 403 | /* |
| 403 | * PageBuddy() indicate that the page is free and in the buddy system | 404 | * PageBuddy() indicate that the page is free and in the buddy system |
| 404 | * (see mm/page_alloc.c). | 405 | * (see mm/page_alloc.c). |
| 406 | * | ||
| 407 | * PAGE_BUDDY_MAPCOUNT_VALUE must be <= -2 but better not too close to | ||
| 408 | * -2 so that an underflow of the page_mapcount() won't be mistaken | ||
| 409 | * for a genuine PAGE_BUDDY_MAPCOUNT_VALUE. -128 can be created very | ||
| 410 | * efficiently by most CPU architectures. | ||
| 405 | */ | 411 | */ |
| 412 | #define PAGE_BUDDY_MAPCOUNT_VALUE (-128) | ||
| 413 | |||
| 406 | static inline int PageBuddy(struct page *page) | 414 | static inline int PageBuddy(struct page *page) |
| 407 | { | 415 | { |
| 408 | return atomic_read(&page->_mapcount) == -2; | 416 | return atomic_read(&page->_mapcount) == PAGE_BUDDY_MAPCOUNT_VALUE; |
| 409 | } | 417 | } |
| 410 | 418 | ||
| 411 | static inline void __SetPageBuddy(struct page *page) | 419 | static inline void __SetPageBuddy(struct page *page) |
| 412 | { | 420 | { |
| 413 | VM_BUG_ON(atomic_read(&page->_mapcount) != -1); | 421 | VM_BUG_ON(atomic_read(&page->_mapcount) != -1); |
| 414 | atomic_set(&page->_mapcount, -2); | 422 | atomic_set(&page->_mapcount, PAGE_BUDDY_MAPCOUNT_VALUE); |
| 415 | } | 423 | } |
| 416 | 424 | ||
| 417 | static inline void __ClearPageBuddy(struct page *page) | 425 | static inline void __ClearPageBuddy(struct page *page) |
| @@ -852,7 +860,14 @@ extern void pagefault_out_of_memory(void); | |||
| 852 | 860 | ||
| 853 | #define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) | 861 | #define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) |
| 854 | 862 | ||
| 863 | /* | ||
| 864 | * Flags passed to __show_mem() and __show_free_areas() to suppress output in | ||
| 865 | * various contexts. | ||
| 866 | */ | ||
| 867 | #define SHOW_MEM_FILTER_NODES (0x0001u) /* filter disallowed nodes */ | ||
| 868 | |||
| 855 | extern void show_free_areas(void); | 869 | extern void show_free_areas(void); |
| 870 | extern void __show_free_areas(unsigned int flags); | ||
| 856 | 871 | ||
| 857 | int shmem_lock(struct file *file, int lock, struct user_struct *user); | 872 | int shmem_lock(struct file *file, int lock, struct user_struct *user); |
| 858 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); | 873 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); |
| @@ -899,6 +914,9 @@ unsigned long unmap_vmas(struct mmu_gather **tlb, | |||
| 899 | * @pgd_entry: if set, called for each non-empty PGD (top-level) entry | 914 | * @pgd_entry: if set, called for each non-empty PGD (top-level) entry |
| 900 | * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry | 915 | * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry |
| 901 | * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry | 916 | * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry |
| 917 | * this handler is required to be able to handle | ||
| 918 | * pmd_trans_huge() pmds. They may simply choose to | ||
| 919 | * split_huge_page() instead of handling it explicitly. | ||
| 902 | * @pte_entry: if set, called for each non-empty PTE (4th-level) entry | 920 | * @pte_entry: if set, called for each non-empty PTE (4th-level) entry |
| 903 | * @pte_hole: if set, called for each hole at all levels | 921 | * @pte_hole: if set, called for each hole at all levels |
| 904 | * @hugetlb_entry: if set, called for each hugetlb entry | 922 | * @hugetlb_entry: if set, called for each hugetlb entry |
| @@ -965,6 +983,10 @@ static inline int handle_mm_fault(struct mm_struct *mm, | |||
| 965 | extern int make_pages_present(unsigned long addr, unsigned long end); | 983 | extern int make_pages_present(unsigned long addr, unsigned long end); |
| 966 | extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); | 984 | extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); |
| 967 | 985 | ||
| 986 | int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | ||
| 987 | unsigned long start, int len, unsigned int foll_flags, | ||
| 988 | struct page **pages, struct vm_area_struct **vmas, | ||
| 989 | int *nonblocking); | ||
| 968 | int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | 990 | int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, |
| 969 | unsigned long start, int nr_pages, int write, int force, | 991 | unsigned long start, int nr_pages, int write, int force, |
| 970 | struct page **pages, struct vm_area_struct **vmas); | 992 | struct page **pages, struct vm_area_struct **vmas); |
| @@ -1309,8 +1331,6 @@ int add_from_early_node_map(struct range *range, int az, | |||
| 1309 | int nr_range, int nid); | 1331 | int nr_range, int nid); |
| 1310 | u64 __init find_memory_core_early(int nid, u64 size, u64 align, | 1332 | u64 __init find_memory_core_early(int nid, u64 size, u64 align, |
| 1311 | u64 goal, u64 limit); | 1333 | u64 goal, u64 limit); |
| 1312 | void *__alloc_memory_core_early(int nodeid, u64 size, u64 align, | ||
| 1313 | u64 goal, u64 limit); | ||
| 1314 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); | 1334 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); |
| 1315 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); | 1335 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); |
| 1316 | extern void sparse_memory_present_with_active_regions(int nid); | 1336 | extern void sparse_memory_present_with_active_regions(int nid); |
| @@ -1339,6 +1359,7 @@ extern void calculate_zone_inactive_ratio(struct zone *zone); | |||
| 1339 | extern void mem_init(void); | 1359 | extern void mem_init(void); |
| 1340 | extern void __init mmap_init(void); | 1360 | extern void __init mmap_init(void); |
| 1341 | extern void show_mem(void); | 1361 | extern void show_mem(void); |
| 1362 | extern void __show_mem(unsigned int flags); | ||
| 1342 | extern void si_meminfo(struct sysinfo * val); | 1363 | extern void si_meminfo(struct sysinfo * val); |
| 1343 | extern void si_meminfo_node(struct sysinfo *val, int nid); | 1364 | extern void si_meminfo_node(struct sysinfo *val, int nid); |
| 1344 | extern int after_bootmem; | 1365 | extern int after_bootmem; |
| @@ -1528,8 +1549,11 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address, | |||
| 1528 | #define FOLL_GET 0x04 /* do get_page on page */ | 1549 | #define FOLL_GET 0x04 /* do get_page on page */ |
| 1529 | #define FOLL_DUMP 0x08 /* give error on hole if it would be zero */ | 1550 | #define FOLL_DUMP 0x08 /* give error on hole if it would be zero */ |
| 1530 | #define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */ | 1551 | #define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */ |
| 1552 | #define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO | ||
| 1553 | * and return without waiting upon it */ | ||
| 1531 | #define FOLL_MLOCK 0x40 /* mark page as mlocked */ | 1554 | #define FOLL_MLOCK 0x40 /* mark page as mlocked */ |
| 1532 | #define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ | 1555 | #define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ |
| 1556 | #define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ | ||
| 1533 | 1557 | ||
| 1534 | typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, | 1558 | typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, |
| 1535 | void *data); | 1559 | void *data); |
| @@ -1622,14 +1646,6 @@ extern int sysctl_memory_failure_recovery; | |||
| 1622 | extern void shake_page(struct page *p, int access); | 1646 | extern void shake_page(struct page *p, int access); |
| 1623 | extern atomic_long_t mce_bad_pages; | 1647 | extern atomic_long_t mce_bad_pages; |
| 1624 | extern int soft_offline_page(struct page *page, int flags); | 1648 | extern int soft_offline_page(struct page *page, int flags); |
| 1625 | #ifdef CONFIG_MEMORY_FAILURE | ||
| 1626 | int is_hwpoison_address(unsigned long addr); | ||
| 1627 | #else | ||
| 1628 | static inline int is_hwpoison_address(unsigned long addr) | ||
| 1629 | { | ||
| 1630 | return 0; | ||
| 1631 | } | ||
| 1632 | #endif | ||
| 1633 | 1649 | ||
| 1634 | extern void dump_page(struct page *page); | 1650 | extern void dump_page(struct page *page); |
| 1635 | 1651 | ||
