Merge updates from Andrew Morton: "Incoming: - a small number of updates to scripts/, ocfs2 and fs/buffer.c - most of MM I still have quite a lot of material (mostly not MM) staged after linux-next due to -next dependencies. I'll send those across next week as the preprequisites get merged up" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (135 commits) mm/page_io.c: annotate refault stalls from swap_readpage mm/Kconfig: fix trivial help text punctuation mm/Kconfig: fix indentation mm/memory_hotplug.c: remove __online_page_set_limits() mm: fix typos in comments when calling __SetPageUptodate() mm: fix struct member name in function comments mm/shmem.c: cast the type of unmap_start to u64 mm: shmem: use proper gfp flags for shmem_writepage() mm/shmem.c: make array 'values' static const, makes object smaller userfaultfd: require CAP_SYS_PTRACE for UFFD_FEATURE_EVENT_FORK fs/userfaultfd.c: wp: clear VM_UFFD_MISSING or VM_UFFD_WP during userfaultfd_register() userfaultfd: wrap the common dst_vma check into an inlined function userfaultfd: remove unnecessary WARN_ON() in __mcopy_atomic_hugetlb() userfaultfd: use vma_pagesize for all huge page size calculation mm/madvise.c: use PAGE_ALIGN[ED] for range checking mm/madvise.c: replace with page_size() in madvise_inject_error() mm/mmap.c: make vma_merge() comment more easy to understand mm/hwpoison-inject: use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops autonuma: reduce cache footprint when scanning page tables autonuma: fix watermark checking in migrate_balanced_pgdat() ...
Showing the changes to include/linux (15 of 95 files). Show all
Unified · Split
| @@ -3156,7 +3156,6 @@ enum { · 3155 unmodified lines | ||
| 3156 | 3156 | }; |
| 3157 | 3157 | |
| 3158 | 3158 | void dio_end_io(struct bio *bio); |
| 3159 | −void dio_warn_stale_pagecache(struct file *filp); | |
| 3160 | 3159 | |
| 3161 | 3160 | ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, |
| 3162 | 3161 | struct block_device *bdev, struct iov_iter *iter, |
| @@ -3201,6 +3200,11 @@ static inline void inode_dio_end(struct inode *inode) · 38 unmodified lines | ||
| 3201 | 3200 | wake_up_bit(&inode->i_state, __I_DIO_WAKEUP); |
| 3202 | 3201 | } |
| 3203 | 3202 | |
| 3203 | +/* | |
| 3204 | + * Warn about a page cache invalidation failure diring a direct I/O write. | |
| 3205 | + */ | |
| 3206 | +void dio_warn_stale_pagecache(struct file *filp); | |
| 3207 | + | |
| 3204 | 3208 | extern void inode_set_flags(struct inode *inode, unsigned int flags, |
| 3205 | 3209 | unsigned int mask); |
| 3206 | 3210 | |
| @@ -612,6 +612,8 @@ static inline bool pm_suspended_storage(void) · 611 unmodified lines | ||
| 612 | 612 | /* The below functions must be run on a range from a single zone. */ |
| 613 | 613 | extern int alloc_contig_range(unsigned long start, unsigned long end, |
| 614 | 614 | unsigned migratetype, gfp_t gfp_mask); |
| 615 | +extern struct page *alloc_contig_pages(unsigned long nr_pages, gfp_t gfp_mask, | |
| 616 | + int nid, nodemask_t *nodemask); | |
| 615 | 617 | #endif |
| 616 | 618 | void free_contig_range(unsigned long pfn, unsigned int nr_pages); |
| 617 | 619 | |
| @@ -105,8 +105,7 @@ void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason); · 104 unmodified lines | ||
| 105 | 105 | void free_huge_page(struct page *page); |
| 106 | 106 | void hugetlb_fix_reserve_counts(struct inode *inode); |
| 107 | 107 | extern struct mutex *hugetlb_fault_mutex_table; |
| 108 | −u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, | |
| 109 | − pgoff_t idx, unsigned long address); | |
| 108 | +u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx); | |
| 110 | 109 | |
| 111 | 110 | pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); |
| 112 | 111 | |
| @@ -164,38 +163,130 @@ static inline void adjust_range_if_pmd_sharing_possible( · 51 unmodified lines | ||
| 164 | 163 | { |
| 165 | 164 | } |
| 166 | 165 | |
| 167 | −#define follow_hugetlb_page(m,v,p,vs,a,b,i,w,n) ({ BUG(); 0; }) | |
| 168 | −#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) | |
| 169 | −#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) | |
| 166 | +static inline long follow_hugetlb_page(struct mm_struct *mm, | |
| 167 | + struct vm_area_struct *vma, struct page **pages, | |
| 168 | + struct vm_area_struct **vmas, unsigned long *position, | |
| 169 | + unsigned long *nr_pages, long i, unsigned int flags, | |
| 170 | + int *nonblocking) | |
| 171 | +{ | |
| 172 | + BUG(); | |
| 173 | + return 0; | |
| 174 | +} | |
| 175 | + | |
| 176 | +static inline struct page *follow_huge_addr(struct mm_struct *mm, | |
| 177 | + unsigned long address, int write) | |
| 178 | +{ | |
| 179 | + return ERR_PTR(-EINVAL); | |
| 180 | +} | |
| 181 | + | |
| 182 | +static inline int copy_hugetlb_page_range(struct mm_struct *dst, | |
| 183 | + struct mm_struct *src, struct vm_area_struct *vma) | |
| 184 | +{ | |
| 185 | + BUG(); | |
| 186 | + return 0; | |
| 187 | +} | |
| 188 | + | |
| 170 | 189 | static inline void hugetlb_report_meminfo(struct seq_file *m) |
| 171 | 190 | { |
| 172 | 191 | } |
| 173 | −#define hugetlb_report_node_meminfo(n, buf) 0 | |
| 192 | + | |
| 193 | +static inline int hugetlb_report_node_meminfo(int nid, char *buf) | |
| 194 | +{ | |
| 195 | + return 0; | |
| 196 | +} | |
| 197 | + | |
| 174 | 198 | static inline void hugetlb_show_meminfo(void) |
| 175 | 199 | { |
| 176 | 200 | } |
| 177 | −#define follow_huge_pd(vma, addr, hpd, flags, pdshift) NULL | |
| 178 | −#define follow_huge_pmd(mm, addr, pmd, flags) NULL | |
| 179 | −#define follow_huge_pud(mm, addr, pud, flags) NULL | |
| 180 | −#define follow_huge_pgd(mm, addr, pgd, flags) NULL | |
| 181 | −#define prepare_hugepage_range(file, addr, len) (-EINVAL) | |
| 182 | −#define pmd_huge(x) 0 | |
| 183 | −#define pud_huge(x) 0 | |
| 184 | −#define is_hugepage_only_range(mm, addr, len) 0 | |
| 185 | −#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) | |
| 186 | −#define hugetlb_mcopy_atomic_pte(dst_mm, dst_pte, dst_vma, dst_addr, \ | |
| 187 | − src_addr, pagep) ({ BUG(); 0; }) | |
| 188 | −#define huge_pte_offset(mm, address, sz) 0 | |
| 201 | + | |
| 202 | +static inline struct page *follow_huge_pd(struct vm_area_struct *vma, | |
| 203 | + unsigned long address, hugepd_t hpd, int flags, | |
| 204 | + int pdshift) | |
| 205 | +{ | |
| 206 | + return NULL; | |
| 207 | +} | |
| 208 | + | |
| 209 | +static inline struct page *follow_huge_pmd(struct mm_struct *mm, | |
| 210 | + unsigned long address, pmd_t *pmd, int flags) | |
| 211 | +{ | |
| 212 | + return NULL; | |
| 213 | +} | |
| 214 | + | |
| 215 | +static inline struct page *follow_huge_pud(struct mm_struct *mm, | |
| 216 | + unsigned long address, pud_t *pud, int flags) | |
| 217 | +{ | |
| 218 | + return NULL; | |
| 219 | +} | |
| 220 | + | |
| 221 | +static inline struct page *follow_huge_pgd(struct mm_struct *mm, | |
| 222 | + unsigned long address, pgd_t *pgd, int flags) | |
| 223 | +{ | |
| 224 | + return NULL; | |
| 225 | +} | |
| 226 | + | |
| 227 | +static inline int prepare_hugepage_range(struct file *file, | |
| 228 | + unsigned long addr, unsigned long len) | |
| 229 | +{ | |
| 230 | + return -EINVAL; | |
| 231 | +} | |
| 232 | + | |
| 233 | +static inline int pmd_huge(pmd_t pmd) | |
| 234 | +{ | |
| 235 | + return 0; | |
| 236 | +} | |
| 237 | + | |
| 238 | +static inline int pud_huge(pud_t pud) | |
| 239 | +{ | |
| 240 | + return 0; | |
| 241 | +} | |
| 242 | + | |
| 243 | +static inline int is_hugepage_only_range(struct mm_struct *mm, | |
| 244 | + unsigned long addr, unsigned long len) | |
| 245 | +{ | |
| 246 | + return 0; | |
| 247 | +} | |
| 248 | + | |
| 249 | +static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, | |
| 250 | + unsigned long addr, unsigned long end, | |
| 251 | + unsigned long floor, unsigned long ceiling) | |
| 252 | +{ | |
| 253 | + BUG(); | |
| 254 | +} | |
| 255 | + | |
| 256 | +static inline int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, | |
| 257 | + pte_t *dst_pte, | |
| 258 | + struct vm_area_struct *dst_vma, | |
| 259 | + unsigned long dst_addr, | |
| 260 | + unsigned long src_addr, | |
| 261 | + struct page **pagep) | |
| 262 | +{ | |
| 263 | + BUG(); | |
| 264 | + return 0; | |
| 265 | +} | |
| 266 | + | |
| 267 | +static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, | |
| 268 | + unsigned long sz) | |
| 269 | +{ | |
| 270 | + return NULL; | |
| 271 | +} | |
| 189 | 272 | |
| 190 | 273 | static inline bool isolate_huge_page(struct page *page, struct list_head *list) |
| 191 | 274 | { |
| 192 | 275 | return false; |
| 193 | 276 | } |
| 194 | −#define putback_active_hugepage(p) do {} while (0) | |
| 195 | −#define move_hugetlb_state(old, new, reason) do {} while (0) | |
| 196 | 277 | |
| 197 | −static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma, | |
| 198 | − unsigned long address, unsigned long end, pgprot_t newprot) | |
| 278 | +static inline void putback_active_hugepage(struct page *page) | |
| 279 | +{ | |
| 280 | +} | |
| 281 | + | |
| 282 | +static inline void move_hugetlb_state(struct page *oldpage, | |
| 283 | + struct page *newpage, int reason) | |
| 284 | +{ | |
| 285 | +} | |
| 286 | + | |
| 287 | +static inline unsigned long hugetlb_change_protection( | |
| 288 | + struct vm_area_struct *vma, unsigned long address, | |
| 289 | + unsigned long end, pgprot_t newprot) | |
| 199 | 290 | { |
| 200 | 291 | return 0; |
| 201 | 292 | } |
| @@ -213,9 +304,10 @@ static inline void __unmap_hugepage_range(struct mmu_gather *tlb, · 11 unmodified lines | ||
| 213 | 304 | { |
| 214 | 305 | BUG(); |
| 215 | 306 | } |
| 307 | + | |
| 216 | 308 | static inline vm_fault_t hugetlb_fault(struct mm_struct *mm, |
| 217 | − struct vm_area_struct *vma, unsigned long address, | |
| 218 | − unsigned int flags) | |
| 309 | + struct vm_area_struct *vma, unsigned long address, | |
| 310 | + unsigned int flags) | |
| 219 | 311 | { |
| 220 | 312 | BUG(); |
| 221 | 313 | return 0; |
| @@ -70,8 +70,18 @@ struct kasan_cache { · 69 unmodified lines | ||
| 70 | 70 | int free_meta_offset; |
| 71 | 71 | }; |
| 72 | 72 | |
| 73 | +/* | |
| 74 | + * These functions provide a special case to support backing module | |
| 75 | + * allocations with real shadow memory. With KASAN vmalloc, the special | |
| 76 | + * case is unnecessary, as the work is handled in the generic case. | |
| 77 | + */ | |
| 78 | +#ifndef CONFIG_KASAN_VMALLOC | |
| 73 | 79 | int kasan_module_alloc(void *addr, size_t size); |
| 74 | 80 | void kasan_free_shadow(const struct vm_struct *vm); |
| 81 | +#else | |
| 82 | +static inline int kasan_module_alloc(void *addr, size_t size) { return 0; } | |
| 83 | +static inline void kasan_free_shadow(const struct vm_struct *vm) {} | |
| 84 | +#endif | |
| 75 | 85 | |
| 76 | 86 | int kasan_add_zero_shadow(void *start, unsigned long size); |
| 77 | 87 | void kasan_remove_zero_shadow(void *start, unsigned long size); |
| @@ -194,4 +204,25 @@ static inline void *kasan_reset_tag(const void *addr) · 116 unmodified lines | ||
| 194 | 204 | |
| 195 | 205 | #endif /* CONFIG_KASAN_SW_TAGS */ |
| 196 | 206 | |
| 207 | +#ifdef CONFIG_KASAN_VMALLOC | |
| 208 | +int kasan_populate_vmalloc(unsigned long requested_size, | |
| 209 | + struct vm_struct *area); | |
| 210 | +void kasan_poison_vmalloc(void *start, unsigned long size); | |
| 211 | +void kasan_release_vmalloc(unsigned long start, unsigned long end, | |
| 212 | + unsigned long free_region_start, | |
| 213 | + unsigned long free_region_end); | |
| 214 | +#else | |
| 215 | +static inline int kasan_populate_vmalloc(unsigned long requested_size, | |
| 216 | + struct vm_struct *area) | |
| 217 | +{ | |
| 218 | + return 0; | |
| 219 | +} | |
| 220 | + | |
| 221 | +static inline void kasan_poison_vmalloc(void *start, unsigned long size) {} | |
| 222 | +static inline void kasan_release_vmalloc(unsigned long start, | |
| 223 | + unsigned long end, | |
| 224 | + unsigned long free_region_start, | |
| 225 | + unsigned long free_region_end) {} | |
| 226 | +#endif | |
| 227 | + | |
| 197 | 228 | #endif /* LINUX_KASAN_H */ |
| @@ -358,6 +358,9 @@ static inline phys_addr_t memblock_phys_alloc(phys_addr_t size, · 357 unmodified lines | ||
| 358 | 358 | MEMBLOCK_ALLOC_ACCESSIBLE); |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | +void *memblock_alloc_exact_nid_raw(phys_addr_t size, phys_addr_t align, | |
| 362 | + phys_addr_t min_addr, phys_addr_t max_addr, | |
| 363 | + int nid); | |
| 361 | 364 | void *memblock_alloc_try_nid_raw(phys_addr_t size, phys_addr_t align, |
| 362 | 365 | phys_addr_t min_addr, phys_addr_t max_addr, |
| 363 | 366 | int nid); |
| @@ -58,7 +58,6 @@ enum mem_cgroup_protection { · 57 unmodified lines | ||
| 58 | 58 | |
| 59 | 59 | struct mem_cgroup_reclaim_cookie { |
| 60 | 60 | pg_data_t *pgdat; |
| 61 | − int priority; | |
| 62 | 61 | unsigned int generation; |
| 63 | 62 | }; |
| 64 | 63 | |
| @@ -81,7 +80,6 @@ struct mem_cgroup_id { · 16 unmodified lines | ||
| 81 | 80 | enum mem_cgroup_events_target { |
| 82 | 81 | MEM_CGROUP_TARGET_THRESH, |
| 83 | 82 | MEM_CGROUP_TARGET_SOFTLIMIT, |
| 84 | − MEM_CGROUP_TARGET_NUMAINFO, | |
| 85 | 83 | MEM_CGROUP_NTARGETS, |
| 86 | 84 | }; |
| 87 | 85 | |
| @@ -112,7 +110,7 @@ struct memcg_shrinker_map { · 24 unmodified lines | ||
| 112 | 110 | }; |
| 113 | 111 | |
| 114 | 112 | /* |
| 115 | − * per-zone information in memory controller. | |
| 113 | + * per-node information in memory controller. | |
| 116 | 114 | */ |
| 117 | 115 | struct mem_cgroup_per_node { |
| 118 | 116 | struct lruvec lruvec; |
| @@ -126,7 +124,7 @@ struct mem_cgroup_per_node { · 7 unmodified lines | ||
| 126 | 124 | |
| 127 | 125 | unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS]; |
| 128 | 126 | |
| 129 | − struct mem_cgroup_reclaim_iter iter[DEF_PRIORITY + 1]; | |
| 127 | + struct mem_cgroup_reclaim_iter iter; | |
| 130 | 128 | |
| 131 | 129 | struct memcg_shrinker_map __rcu *shrinker_map; |
| 132 | 130 | |
| @@ -134,9 +132,6 @@ struct mem_cgroup_per_node { · 1 unmodified line | ||
| 134 | 132 | unsigned long usage_in_excess;/* Set to the value by which */ |
| 135 | 133 | /* the soft limit is exceeded*/ |
| 136 | 134 | bool on_tree; |
| 137 | − bool congested; /* memcg has many dirty pages */ | |
| 138 | − /* backed by a congested BDI */ | |
| 139 | − | |
| 140 | 135 | struct mem_cgroup *memcg; /* Back pointer, we cannot */ |
| 141 | 136 | /* use container_of */ |
| 142 | 137 | }; |
| @@ -313,13 +308,6 @@ struct mem_cgroup { · 170 unmodified lines | ||
| 313 | 308 | struct list_head kmem_caches; |
| 314 | 309 | #endif |
| 315 | 310 | |
| 316 | − int last_scanned_node; | |
| 317 | −#if MAX_NUMNODES > 1 | |
| 318 | − nodemask_t scan_nodes; | |
| 319 | − atomic_t numainfo_events; | |
| 320 | − atomic_t numainfo_updating; | |
| 321 | −#endif | |
| 322 | − | |
| 323 | 311 | #ifdef CONFIG_CGROUP_WRITEBACK |
| 324 | 312 | struct list_head cgwb_list; |
| 325 | 313 | struct wb_domain cgwb_domain; |
| @@ -394,25 +382,27 @@ mem_cgroup_nodeinfo(struct mem_cgroup *memcg, int nid) · 68 unmodified lines | ||
| 394 | 382 | } |
| 395 | 383 | |
| 396 | 384 | /** |
| 397 | − * mem_cgroup_lruvec - get the lru list vector for a node or a memcg zone | |
| 398 | − * @node: node of the wanted lruvec | |
| 385 | + * mem_cgroup_lruvec - get the lru list vector for a memcg & node | |
| 399 | 386 | * @memcg: memcg of the wanted lruvec |
| 400 | 387 | * |
| 401 | − * Returns the lru list vector holding pages for a given @node or a given | |
| 402 | − * @memcg and @zone. This can be the node lruvec, if the memory controller | |
| 403 | − * is disabled. | |
| 388 | + * Returns the lru list vector holding pages for a given @memcg & | |
| 389 | + * @node combination. This can be the node lruvec, if the memory | |
| 390 | + * controller is disabled. | |
| 404 | 391 | */ |
| 405 | −static inline struct lruvec *mem_cgroup_lruvec(struct pglist_data *pgdat, | |
| 406 | − struct mem_cgroup *memcg) | |
| 392 | +static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg, | |
| 393 | + struct pglist_data *pgdat) | |
| 407 | 394 | { |
| 408 | 395 | struct mem_cgroup_per_node *mz; |
| 409 | 396 | struct lruvec *lruvec; |
| 410 | 397 | |
| 411 | 398 | if (mem_cgroup_disabled()) { |
| 412 | − lruvec = node_lruvec(pgdat); | |
| 399 | + lruvec = &pgdat->__lruvec; | |
| 413 | 400 | goto out; |
| 414 | 401 | } |
| 415 | 402 | |
| 403 | + if (!memcg) | |
| 404 | + memcg = root_mem_cgroup; | |
| 405 | + | |
| 416 | 406 | mz = mem_cgroup_nodeinfo(memcg, pgdat->node_id); |
| 417 | 407 | lruvec = &mz->lruvec; |
| 418 | 408 | out: |
| @@ -728,7 +718,7 @@ static inline void __mod_lruvec_page_state(struct page *page, · 309 unmodified lines | ||
| 728 | 718 | return; |
| 729 | 719 | } |
| 730 | 720 | |
| 731 | − lruvec = mem_cgroup_lruvec(pgdat, page->mem_cgroup); | |
| 721 | + lruvec = mem_cgroup_lruvec(page->mem_cgroup, pgdat); | |
| 732 | 722 | __mod_lruvec_state(lruvec, idx, val); |
| 733 | 723 | } |
| 734 | 724 | |
| @@ -899,16 +889,21 @@ static inline void mem_cgroup_migrate(struct page *old, struct page *new) · 164 unmodified lines | ||
| 899 | 889 | { |
| 900 | 890 | } |
| 901 | 891 | |
| 902 | −static inline struct lruvec *mem_cgroup_lruvec(struct pglist_data *pgdat, | |
| 903 | − struct mem_cgroup *memcg) | |
| 892 | +static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg, | |
| 893 | + struct pglist_data *pgdat) | |
| 904 | 894 | { |
| 905 | − return node_lruvec(pgdat); | |
| 895 | + return &pgdat->__lruvec; | |
| 906 | 896 | } |
| 907 | 897 | |
| 908 | 898 | static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page, |
| 909 | 899 | struct pglist_data *pgdat) |
| 910 | 900 | { |
| 911 | − return &pgdat->lruvec; | |
| 901 | + return &pgdat->__lruvec; | |
| 902 | +} | |
| 903 | + | |
| 904 | +static inline struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg) | |
| 905 | +{ | |
| 906 | + return NULL; | |
| 912 | 907 | } |
| 913 | 908 | |
| 914 | 909 | static inline bool mm_match_cgroup(struct mm_struct *mm, |
| @@ -102,13 +102,10 @@ extern unsigned long __offline_isolated_pages(unsigned long start_pfn, · 101 unmodified lines | ||
| 102 | 102 | |
| 103 | 103 | typedef void (*online_page_callback_t)(struct page *page, unsigned int order); |
| 104 | 104 | |
| 105 | +extern void generic_online_page(struct page *page, unsigned int order); | |
| 105 | 106 | extern int set_online_page_callback(online_page_callback_t callback); |
| 106 | 107 | extern int restore_online_page_callback(online_page_callback_t callback); |
| 107 | 108 | |
| 108 | −extern void __online_page_set_limits(struct page *page); | |
| 109 | −extern void __online_page_increment_counters(struct page *page); | |
| 110 | −extern void __online_page_free(struct page *page); | |
| 111 | − | |
| 112 | 109 | extern int try_online_node(int nid); |
| 113 | 110 | |
| 114 | 111 | extern int arch_add_memory(int nid, u64 start, u64 size, |
| @@ -229,9 +226,6 @@ void put_online_mems(void); · 114 unmodified lines | ||
| 229 | 226 | void mem_hotplug_begin(void); |
| 230 | 227 | void mem_hotplug_done(void); |
| 231 | 228 | |
| 232 | −extern void set_zone_contiguous(struct zone *zone); | |
| 233 | −extern void clear_zone_contiguous(struct zone *zone); | |
| 234 | − | |
| 235 | 229 | #else /* ! CONFIG_MEMORY_HOTPLUG */ |
| 236 | 230 | #define pfn_to_online_page(pfn) \ |
| 237 | 231 | ({ \ |
| @@ -339,6 +333,9 @@ static inline int remove_memory(int nid, u64 start, u64 size) · 101 unmodified lines | ||
| 339 | 333 | static inline void __remove_memory(int nid, u64 start, u64 size) {} |
| 340 | 334 | #endif /* CONFIG_MEMORY_HOTREMOVE */ |
| 341 | 335 | |
| 336 | +extern void set_zone_contiguous(struct zone *zone); | |
| 337 | +extern void clear_zone_contiguous(struct zone *zone); | |
| 338 | + | |
| 342 | 339 | extern void __ref free_area_init_core_hotplug(int nid); |
| 343 | 340 | extern int __add_memory(int nid, u64 start, u64 size); |
| 344 | 341 | extern int add_memory(int nid, u64 start, u64 size); |
| @@ -564,21 +564,6 @@ int vma_is_stack_for_current(struct vm_area_struct *vma); · 563 unmodified lines | ||
| 564 | 564 | struct mmu_gather; |
| 565 | 565 | struct inode; |
| 566 | 566 | |
| 567 | −#if !defined(CONFIG_ARCH_HAS_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE) | |
| 568 | −static inline int pmd_devmap(pmd_t pmd) | |
| 569 | −{ | |
| 570 | − return 0; | |
| 571 | −} | |
| 572 | −static inline int pud_devmap(pud_t pud) | |
| 573 | −{ | |
| 574 | − return 0; | |
| 575 | −} | |
| 576 | −static inline int pgd_devmap(pgd_t pgd) | |
| 577 | −{ | |
| 578 | − return 0; | |
| 579 | −} | |
| 580 | −#endif | |
| 581 | − | |
| 582 | 567 | /* |
| 583 | 568 | * FIXME: take this include out, include page-flags.h in |
| 584 | 569 | * files which need it (119 of them) |
| @@ -1643,19 +1628,27 @@ static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) · 1058 unmodified lines | ||
| 1643 | 1628 | return (unsigned long)val; |
| 1644 | 1629 | } |
| 1645 | 1630 | |
| 1631 | +void mm_trace_rss_stat(struct mm_struct *mm, int member, long count); | |
| 1632 | + | |
| 1646 | 1633 | static inline void add_mm_counter(struct mm_struct *mm, int member, long value) |
| 1647 | 1634 | { |
| 1648 | − atomic_long_add(value, &mm->rss_stat.count[member]); | |
| 1635 | + long count = atomic_long_add_return(value, &mm->rss_stat.count[member]); | |
| 1636 | + | |
| 1637 | + mm_trace_rss_stat(mm, member, count); | |
| 1649 | 1638 | } |
| 1650 | 1639 | |
| 1651 | 1640 | static inline void inc_mm_counter(struct mm_struct *mm, int member) |
| 1652 | 1641 | { |
| 1653 | − atomic_long_inc(&mm->rss_stat.count[member]); | |
| 1642 | + long count = atomic_long_inc_return(&mm->rss_stat.count[member]); | |
| 1643 | + | |
| 1644 | + mm_trace_rss_stat(mm, member, count); | |
| 1654 | 1645 | } |
| 1655 | 1646 | |
| 1656 | 1647 | static inline void dec_mm_counter(struct mm_struct *mm, int member) |
| 1657 | 1648 | { |
| 1658 | − atomic_long_dec(&mm->rss_stat.count[member]); | |
| 1649 | + long count = atomic_long_dec_return(&mm->rss_stat.count[member]); | |
| 1650 | + | |
| 1651 | + mm_trace_rss_stat(mm, member, count); | |
| 1659 | 1652 | } |
| 1660 | 1653 | |
| 1661 | 1654 | /* Optimized variant when page is already known not to be PageAnon */ |
| @@ -2214,9 +2207,6 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...); · 552 unmodified lines | ||
| 2214 | 2207 | |
| 2215 | 2208 | extern void setup_per_cpu_pageset(void); |
| 2216 | 2209 | |
| 2217 | −extern void zone_pcp_update(struct zone *zone); | |
| 2218 | −extern void zone_pcp_reset(struct zone *zone); | |
| 2219 | − | |
| 2220 | 2210 | /* page_alloc.c */ |
| 2221 | 2211 | extern int min_free_kbytes; |
| 2222 | 2212 | extern int watermark_boost_factor; |
| @@ -2780,7 +2770,7 @@ extern int sysctl_memory_failure_early_kill; · 557 unmodified lines | ||
| 2780 | 2770 | extern int sysctl_memory_failure_recovery; |
| 2781 | 2771 | extern void shake_page(struct page *p, int access); |
| 2782 | 2772 | extern atomic_long_t num_poisoned_pages __read_mostly; |
| 2783 | −extern int soft_offline_page(struct page *page, int flags); | |
| 2773 | +extern int soft_offline_page(unsigned long pfn, int flags); | |
| 2784 | 2774 | |
| 2785 | 2775 | |
| 2786 | 2776 | /* |
| @@ -273,12 +273,12 @@ enum lru_list { · 272 unmodified lines | ||
| 273 | 273 | |
| 274 | 274 | #define for_each_evictable_lru(lru) for (lru = 0; lru <= LRU_ACTIVE_FILE; lru++) |
| 275 | 275 | |
| 276 | −static inline int is_file_lru(enum lru_list lru) | |
| 276 | +static inline bool is_file_lru(enum lru_list lru) | |
| 277 | 277 | { |
| 278 | 278 | return (lru == LRU_INACTIVE_FILE || lru == LRU_ACTIVE_FILE); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | −static inline int is_active_lru(enum lru_list lru) | |
| 281 | +static inline bool is_active_lru(enum lru_list lru) | |
| 282 | 282 | { |
| 283 | 283 | return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE); |
| 284 | 284 | } |
| @@ -296,6 +296,12 @@ struct zone_reclaim_stat { · 11 unmodified lines | ||
| 296 | 296 | unsigned long recent_scanned[2]; |
| 297 | 297 | }; |
| 298 | 298 | |
| 299 | +enum lruvec_flags { | |
| 300 | + LRUVEC_CONGESTED, /* lruvec has many dirty pages | |
| 301 | + * backed by a congested BDI | |
| 302 | + */ | |
| 303 | +}; | |
| 304 | + | |
| 299 | 305 | struct lruvec { |
| 300 | 306 | struct list_head lists[NR_LRU_LISTS]; |
| 301 | 307 | struct zone_reclaim_stat reclaim_stat; |
| @@ -303,12 +309,14 @@ struct lruvec { · 1 unmodified line | ||
| 303 | 309 | atomic_long_t inactive_age; |
| 304 | 310 | /* Refaults at the time of last reclaim cycle */ |
| 305 | 311 | unsigned long refaults; |
| 312 | + /* Various lruvec state flags (enum lruvec_flags) */ | |
| 313 | + unsigned long flags; | |
| 306 | 314 | #ifdef CONFIG_MEMCG |
| 307 | 315 | struct pglist_data *pgdat; |
| 308 | 316 | #endif |
| 309 | 317 | }; |
| 310 | 318 | |
| 311 | −/* Isolate unmapped file */ | |
| 319 | +/* Isolate unmapped pages */ | |
| 312 | 320 | #define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x2) |
| 313 | 321 | /* Isolate for asynchronous migration */ |
| 314 | 322 | #define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x4) |
| @@ -572,9 +580,6 @@ struct zone { · 257 unmodified lines | ||
| 572 | 580 | } ____cacheline_internodealigned_in_smp; |
| 573 | 581 | |
| 574 | 582 | enum pgdat_flags { |
| 575 | − PGDAT_CONGESTED, /* pgdat has many dirty pages backed by | |
| 576 | − * a congested BDI | |
| 577 | − */ | |
| 578 | 583 | PGDAT_DIRTY, /* reclaim scanning has recently found |
| 579 | 584 | * many dirty file pages at the tail |
| 580 | 585 | * of the LRU. |
| @@ -777,7 +782,13 @@ typedef struct pglist_data { · 196 unmodified lines | ||
| 777 | 782 | #endif |
| 778 | 783 | |
| 779 | 784 | /* Fields commonly accessed by the page reclaim scanner */ |
| 780 | − struct lruvec lruvec; | |
| 785 | + | |
| 786 | + /* | |
| 787 | + * NOTE: THIS IS UNUSED IF MEMCG IS ENABLED. | |
| 788 | + * | |
| 789 | + * Use mem_cgroup_lruvec() to look up lruvecs. | |
| 790 | + */ | |
| 791 | + struct lruvec __lruvec; | |
| 781 | 792 | |
| 782 | 793 | unsigned long flags; |
| 783 | 794 | |
| @@ -800,11 +811,6 @@ typedef struct pglist_data { · 16 unmodified lines | ||
| 800 | 811 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
| 801 | 812 | #define node_end_pfn(nid) pgdat_end_pfn(NODE_DATA(nid)) |
| 802 | 813 | |
| 803 | −static inline struct lruvec *node_lruvec(struct pglist_data *pgdat) | |
| 804 | −{ | |
| 805 | − return &pgdat->lruvec; | |
| 806 | −} | |
| 807 | − | |
| 808 | 814 | static inline unsigned long pgdat_end_pfn(pg_data_t *pgdat) |
| 809 | 815 | { |
| 810 | 816 | return pgdat->node_start_pfn + pgdat->node_spanned_pages; |
| @@ -842,7 +848,7 @@ static inline struct pglist_data *lruvec_pgdat(struct lruvec *lruvec) · 31 unmodified lines | ||
| 842 | 848 | #ifdef CONFIG_MEMCG |
| 843 | 849 | return lruvec->pgdat; |
| 844 | 850 | #else |
| 845 | − return container_of(lruvec, struct pglist_data, lruvec); | |
| 851 | + return container_of(lruvec, struct pglist_data, __lruvec); | |
| 846 | 852 | #endif |
| 847 | 853 | } |
| 848 | 854 | |
| @@ -1079,7 +1085,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist, · 230 unmodified lines | ||
| 1079 | 1085 | /** |
| 1080 | 1086 | * for_each_zone_zonelist_nodemask - helper macro to iterate over valid zones in a zonelist at or below a given zone index and within a nodemask |
| 1081 | 1087 | * @zone - The current zone in the iterator |
| 1082 | − * @z - The current pointer within zonelist->zones being iterated | |
| 1088 | + * @z - The current pointer within zonelist->_zonerefs being iterated | |
| 1083 | 1089 | * @zlist - The zonelist being iterated |
| 1084 | 1090 | * @highidx - The zone index of the highest zone to return |
| 1085 | 1091 | * @nodemask - Nodemask allowed by the allocator |
| @@ -91,7 +91,7 @@ void module_arch_cleanup(struct module *mod); · 90 unmodified lines | ||
| 91 | 91 | /* Any cleanup before freeing mod->module_init */ |
| 92 | 92 | void module_arch_freeing_init(struct module *mod); |
| 93 | 93 | |
| 94 | −#ifdef CONFIG_KASAN | |
| 94 | +#if defined(CONFIG_KASAN) && !defined(CONFIG_KASAN_VMALLOC) | |
| 95 | 95 | #include <linux/kasan.h> |
| 96 | 96 | #define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT) |
| 97 | 97 | #else |
| @@ -30,7 +30,7 @@ static inline bool is_migrate_isolate(int migratetype) · 29 unmodified lines | ||
| 30 | 30 | } |
| 31 | 31 | #endif |
| 32 | 32 | |
| 33 | −#define SKIP_HWPOISON 0x1 | |
| 33 | +#define MEMORY_OFFLINE 0x1 | |
| 34 | 34 | #define REPORT_FAILURE 0x2 |
| 35 | 35 | |
| 36 | 36 | bool has_unmovable_pages(struct zone *zone, struct page *page, int count, |
| @@ -58,7 +58,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, · 21 unmodified lines | ||
| 58 | 58 | * Test all pages in [start_pfn, end_pfn) are isolated or not. |
| 59 | 59 | */ |
| 60 | 60 | int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn, |
| 61 | − bool skip_hwpoisoned_pages); | |
| 61 | + int isol_flags); | |
| 62 | 62 | |
| 63 | 63 | struct page *alloc_migrate_target(struct page *page, unsigned long private); |
| 64 | 64 | |
| @@ -561,26 +561,6 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) · 560 unmodified lines | ||
| 561 | 561 | return __kmalloc(size, flags); |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | −/* | |
| 565 | − * Determine size used for the nth kmalloc cache. | |
| 566 | − * return size or 0 if a kmalloc cache for that | |
| 567 | − * size does not exist | |
| 568 | − */ | |
| 569 | −static __always_inline unsigned int kmalloc_size(unsigned int n) | |
| 570 | −{ | |
| 571 | −#ifndef CONFIG_SLOB | |
| 572 | − if (n > 2) | |
| 573 | − return 1U << n; | |
| 574 | − | |
| 575 | − if (n == 1 && KMALLOC_MIN_SIZE <= 32) | |
| 576 | − return 96; | |
| 577 | − | |
| 578 | − if (n == 2 && KMALLOC_MIN_SIZE <= 64) | |
| 579 | − return 192; | |
| 580 | −#endif | |
| 581 | − return 0; | |
| 582 | −} | |
| 583 | − | |
| 584 | 564 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) |
| 585 | 565 | { |
| 586 | 566 | #ifndef CONFIG_SLOB |
| @@ -216,6 +216,8 @@ int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4); · 215 unmodified lines | ||
| 216 | 216 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, |
| 217 | 217 | const void *from, size_t available); |
| 218 | 218 | |
| 219 | +int ptr_to_hashval(const void *ptr, unsigned long *hashval_out); | |
| 220 | + | |
| 219 | 221 | /** |
| 220 | 222 | * strstarts - does @str start with @prefix? |
| 221 | 223 | * @str: string to examine |
| @@ -307,7 +307,7 @@ struct vma_swap_readahead { · 306 unmodified lines | ||
| 307 | 307 | }; |
| 308 | 308 | |
| 309 | 309 | /* linux/mm/workingset.c */ |
| 310 | −void *workingset_eviction(struct page *page); | |
| 310 | +void *workingset_eviction(struct page *page, struct mem_cgroup *target_memcg); | |
| 311 | 311 | void workingset_refault(struct page *page, void *shadow); |
| 312 | 312 | void workingset_activation(struct page *page); |
| 313 | 313 | |
| @@ -22,6 +22,18 @@ struct notifier_block; /* in notifier.h */ · 21 unmodified lines | ||
| 22 | 22 | #define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */ |
| 23 | 23 | #define VM_NO_GUARD 0x00000040 /* don't add guard page */ |
| 24 | 24 | #define VM_KASAN 0x00000080 /* has allocated kasan shadow memory */ |
| 25 | + | |
| 26 | +/* | |
| 27 | + * VM_KASAN is used slighly differently depending on CONFIG_KASAN_VMALLOC. | |
| 28 | + * | |
| 29 | + * If IS_ENABLED(CONFIG_KASAN_VMALLOC), VM_KASAN is set on a vm_struct after | |
| 30 | + * shadow memory has been mapped. It's used to handle allocation errors so that | |
| 31 | + * we don't try to poision shadow on free if it was never allocated. | |
| 32 | + * | |
| 33 | + * Otherwise, VM_KASAN is set for kasan_module_alloc() allocations and used to | |
| 34 | + * determine which allocations need the module shadow freed. | |
| 35 | + */ | |
| 36 | + | |
| 25 | 37 | /* |
| 26 | 38 | * Memory with VM_FLUSH_RESET_PERMS cannot be freed in an interrupt or with |
| 27 | 39 | * vfree_atomic(). |