Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
"12 patches.

Subsystems affected by this patch series: mm (memcg, zsmalloc, swap,
mailmap, selftests, pagecache, hugetlb, pagemap), lib, and coredump"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
mm/mmap.c: fix mmap return value when vma is merged after call_mmap()
hugetlb_cgroup: fix offline of hugetlb cgroup with reservations
mm/filemap: add static for function __add_to_page_cache_locked
userfaultfd: selftests: fix SIGSEGV if huge mmap fails
tools/testing/selftests/vm: fix build error
mailmap: add two more addresses of Uwe Kleine-König
mm/swapfile: do not sleep with a spin lock held
mm/zsmalloc.c: drop ZSMALLOC_PGTABLE_MAPPING
mm: list_lru: set shrinker map bit when child nr_items is not zero
mm: memcg/slab: fix obj_cgroup_charge() return value handling
coredump: fix core_pattern parse error
zlib: export S390 symbols for zlib modules

+75 -121
+2
.mailmap
··· 322 322 Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com> 323 323 Tycho Andersen <tycho@tycho.pizza> <tycho@tycho.ws> 324 324 Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> 325 + Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 326 + Uwe Kleine-König <ukleinek@strlen.de> 325 327 Uwe Kleine-König <ukl@pengutronix.de> 326 328 Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> 327 329 Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
-1
arch/arm/configs/omap2plus_defconfig
··· 81 81 CONFIG_BINFMT_MISC=y 82 82 CONFIG_CMA=y 83 83 CONFIG_ZSMALLOC=m 84 - CONFIG_ZSMALLOC_PGTABLE_MAPPING=y 85 84 CONFIG_NET=y 86 85 CONFIG_PACKET=y 87 86 CONFIG_UNIX=y
+2 -1
fs/coredump.c
··· 229 229 */ 230 230 if (ispipe) { 231 231 if (isspace(*pat_ptr)) { 232 - was_space = true; 232 + if (cn->used != 0) 233 + was_space = true; 233 234 pat_ptr++; 234 235 continue; 235 236 } else if (was_space) {
-1
include/linux/zsmalloc.h
··· 20 20 * zsmalloc mapping modes 21 21 * 22 22 * NOTE: These only make a difference when a mapped object spans pages. 23 - * They also have no effect when ZSMALLOC_PGTABLE_MAPPING is selected. 24 23 */ 25 24 enum zs_mapmode { 26 25 ZS_MM_RW, /* normal read-write mapping */
+3
lib/zlib_dfltcc/dfltcc_inflate.c
··· 4 4 #include "dfltcc_util.h" 5 5 #include "dfltcc.h" 6 6 #include <asm/setup.h> 7 + #include <linux/export.h> 7 8 #include <linux/zutil.h> 8 9 9 10 /* ··· 30 29 return is_bit_set(dfltcc_state->af.fns, DFLTCC_XPND) && 31 30 is_bit_set(dfltcc_state->af.fmts, DFLTCC_FMT0); 32 31 } 32 + EXPORT_SYMBOL(dfltcc_can_inflate); 33 33 34 34 static int dfltcc_was_inflate_used( 35 35 z_streamp strm ··· 149 147 return (cc == DFLTCC_CC_OP1_TOO_SHORT || cc == DFLTCC_CC_OP2_TOO_SHORT) ? 150 148 DFLTCC_INFLATE_BREAK : DFLTCC_INFLATE_CONTINUE; 151 149 } 150 + EXPORT_SYMBOL(dfltcc_inflate);
-13
mm/Kconfig
··· 707 707 returned by an alloc(). This handle must be mapped in order to 708 708 access the allocated space. 709 709 710 - config ZSMALLOC_PGTABLE_MAPPING 711 - bool "Use page table mapping to access object in zsmalloc" 712 - depends on ZSMALLOC=y 713 - help 714 - By default, zsmalloc uses a copy-based object mapping method to 715 - access allocations that span two pages. However, if a particular 716 - architecture (ex, ARM) performs VM mapping faster than copying, 717 - then you should select this. This causes zsmalloc to use page table 718 - mapping rather than copying for object mapping. 719 - 720 - You can check speed with zsmalloc benchmark: 721 - https://github.com/spartacus06/zsmapbench 722 - 723 710 config ZSMALLOC_STAT 724 711 bool "Export zsmalloc statistics" 725 712 depends on ZSMALLOC
+1 -1
mm/filemap.c
··· 827 827 } 828 828 EXPORT_SYMBOL_GPL(replace_page_cache_page); 829 829 830 - noinline int __add_to_page_cache_locked(struct page *page, 830 + static noinline int __add_to_page_cache_locked(struct page *page, 831 831 struct address_space *mapping, 832 832 pgoff_t offset, gfp_t gfp, 833 833 void **shadowp)
+3 -5
mm/hugetlb_cgroup.c
··· 82 82 83 83 for (idx = 0; idx < hugetlb_max_hstate; idx++) { 84 84 if (page_counter_read( 85 - hugetlb_cgroup_counter_from_cgroup(h_cg, idx)) || 86 - page_counter_read(hugetlb_cgroup_counter_from_cgroup_rsvd( 87 - h_cg, idx))) { 85 + hugetlb_cgroup_counter_from_cgroup(h_cg, idx))) 88 86 return true; 89 - } 90 87 } 91 88 return false; 92 89 } ··· 199 202 struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(css); 200 203 struct hstate *h; 201 204 struct page *page; 202 - int idx = 0; 205 + int idx; 203 206 204 207 do { 208 + idx = 0; 205 209 for_each_hstate(h) { 206 210 spin_lock(&hugetlb_lock); 207 211 list_for_each_entry(page, &h->hugepage_activelist, lru)
+5 -5
mm/list_lru.c
··· 534 534 struct list_lru_node *nlru = &lru->node[nid]; 535 535 int dst_idx = dst_memcg->kmemcg_id; 536 536 struct list_lru_one *src, *dst; 537 - bool set; 538 537 539 538 /* 540 539 * Since list_lru_{add,del} may be called under an IRQ-safe lock, ··· 545 546 dst = list_lru_from_memcg_idx(nlru, dst_idx); 546 547 547 548 list_splice_init(&src->list, &dst->list); 548 - set = (!dst->nr_items && src->nr_items); 549 - dst->nr_items += src->nr_items; 550 - if (set) 549 + 550 + if (src->nr_items) { 551 + dst->nr_items += src->nr_items; 551 552 memcg_set_shrinker_bit(dst_memcg, nid, lru_shrinker_id(lru)); 552 - src->nr_items = 0; 553 + src->nr_items = 0; 554 + } 553 555 554 556 spin_unlock_irq(&nlru->lock); 555 557 }
+12 -14
mm/mmap.c
··· 1808 1808 if (error) 1809 1809 goto unmap_and_free_vma; 1810 1810 1811 + /* Can addr have changed?? 1812 + * 1813 + * Answer: Yes, several device drivers can do it in their 1814 + * f_op->mmap method. -DaveM 1815 + * Bug: If addr is changed, prev, rb_link, rb_parent should 1816 + * be updated for vma_link() 1817 + */ 1818 + WARN_ON_ONCE(addr != vma->vm_start); 1819 + 1820 + addr = vma->vm_start; 1821 + 1811 1822 /* If vm_flags changed after call_mmap(), we should try merge vma again 1812 1823 * as we may succeed this time. 1813 1824 */ ··· 1833 1822 fput(vma->vm_file); 1834 1823 vm_area_free(vma); 1835 1824 vma = merge; 1836 - /* Update vm_flags and possible addr to pick up the change. We don't 1837 - * warn here if addr changed as the vma is not linked by vma_link(). 1838 - */ 1839 - addr = vma->vm_start; 1825 + /* Update vm_flags to pick up the change. */ 1840 1826 vm_flags = vma->vm_flags; 1841 1827 goto unmap_writable; 1842 1828 } 1843 1829 } 1844 1830 1845 - /* Can addr have changed?? 1846 - * 1847 - * Answer: Yes, several device drivers can do it in their 1848 - * f_op->mmap method. -DaveM 1849 - * Bug: If addr is changed, prev, rb_link, rb_parent should 1850 - * be updated for vma_link() 1851 - */ 1852 - WARN_ON_ONCE(addr != vma->vm_start); 1853 - 1854 - addr = vma->vm_start; 1855 1831 vm_flags = vma->vm_flags; 1856 1832 } else if (vm_flags & VM_SHARED) { 1857 1833 error = shmem_zero_setup(vma);
+24 -16
mm/slab.h
··· 274 274 return s->size + sizeof(struct obj_cgroup *); 275 275 } 276 276 277 - static inline struct obj_cgroup *memcg_slab_pre_alloc_hook(struct kmem_cache *s, 278 - size_t objects, 279 - gfp_t flags) 277 + /* 278 + * Returns false if the allocation should fail. 279 + */ 280 + static inline bool memcg_slab_pre_alloc_hook(struct kmem_cache *s, 281 + struct obj_cgroup **objcgp, 282 + size_t objects, gfp_t flags) 280 283 { 281 284 struct obj_cgroup *objcg; 282 285 286 + if (!memcg_kmem_enabled()) 287 + return true; 288 + 289 + if (!(flags & __GFP_ACCOUNT) && !(s->flags & SLAB_ACCOUNT)) 290 + return true; 291 + 283 292 objcg = get_obj_cgroup_from_current(); 284 293 if (!objcg) 285 - return NULL; 294 + return true; 286 295 287 296 if (obj_cgroup_charge(objcg, flags, objects * obj_full_size(s))) { 288 297 obj_cgroup_put(objcg); 289 - return NULL; 298 + return false; 290 299 } 291 300 292 - return objcg; 301 + *objcgp = objcg; 302 + return true; 293 303 } 294 304 295 305 static inline void mod_objcg_state(struct obj_cgroup *objcg, ··· 325 315 unsigned long off; 326 316 size_t i; 327 317 328 - if (!objcg) 318 + if (!memcg_kmem_enabled() || !objcg) 329 319 return; 330 320 331 321 flags &= ~__GFP_ACCOUNT; ··· 410 400 { 411 401 } 412 402 413 - static inline struct obj_cgroup *memcg_slab_pre_alloc_hook(struct kmem_cache *s, 414 - size_t objects, 415 - gfp_t flags) 403 + static inline bool memcg_slab_pre_alloc_hook(struct kmem_cache *s, 404 + struct obj_cgroup **objcgp, 405 + size_t objects, gfp_t flags) 416 406 { 417 - return NULL; 407 + return true; 418 408 } 419 409 420 410 static inline void memcg_slab_post_alloc_hook(struct kmem_cache *s, ··· 518 508 if (should_failslab(s, flags)) 519 509 return NULL; 520 510 521 - if (memcg_kmem_enabled() && 522 - ((flags & __GFP_ACCOUNT) || (s->flags & SLAB_ACCOUNT))) 523 - *objcgp = memcg_slab_pre_alloc_hook(s, size, flags); 511 + if (!memcg_slab_pre_alloc_hook(s, objcgp, size, flags)) 512 + return NULL; 524 513 525 514 return s; 526 515 } ··· 538 529 s->flags, flags); 539 530 } 540 531 541 - if (memcg_kmem_enabled()) 542 - memcg_slab_post_alloc_hook(s, objcg, flags, size, p); 532 + memcg_slab_post_alloc_hook(s, objcg, flags, size, p); 543 533 } 544 534 545 535 #ifndef CONFIG_SLOB
+3 -1
mm/swapfile.c
··· 2867 2867 static struct swap_info_struct *alloc_swap_info(void) 2868 2868 { 2869 2869 struct swap_info_struct *p; 2870 + struct swap_info_struct *defer = NULL; 2870 2871 unsigned int type; 2871 2872 int i; 2872 2873 ··· 2896 2895 smp_wmb(); 2897 2896 WRITE_ONCE(nr_swapfiles, nr_swapfiles + 1); 2898 2897 } else { 2899 - kvfree(p); 2898 + defer = p; 2900 2899 p = swap_info[type]; 2901 2900 /* 2902 2901 * Do not memset this entry: a racing procfs swap_next() ··· 2909 2908 plist_node_init(&p->avail_lists[i], 0); 2910 2909 p->flags = SWP_USED; 2911 2910 spin_unlock(&swap_lock); 2911 + kvfree(defer); 2912 2912 spin_lock_init(&p->lock); 2913 2913 spin_lock_init(&p->cont_lock); 2914 2914
-54
mm/zsmalloc.c
··· 293 293 }; 294 294 295 295 struct mapping_area { 296 - #ifdef CONFIG_ZSMALLOC_PGTABLE_MAPPING 297 - struct vm_struct *vm; /* vm area for mapping object that span pages */ 298 - #else 299 296 char *vm_buf; /* copy buffer for objects that span pages */ 300 - #endif 301 297 char *vm_addr; /* address of kmap_atomic()'ed pages */ 302 298 enum zs_mapmode vm_mm; /* mapping mode */ 303 299 }; ··· 1109 1113 return zspage; 1110 1114 } 1111 1115 1112 - #ifdef CONFIG_ZSMALLOC_PGTABLE_MAPPING 1113 - static inline int __zs_cpu_up(struct mapping_area *area) 1114 - { 1115 - /* 1116 - * Make sure we don't leak memory if a cpu UP notification 1117 - * and zs_init() race and both call zs_cpu_up() on the same cpu 1118 - */ 1119 - if (area->vm) 1120 - return 0; 1121 - area->vm = get_vm_area(PAGE_SIZE * 2, 0); 1122 - if (!area->vm) 1123 - return -ENOMEM; 1124 - 1125 - /* 1126 - * Populate ptes in advance to avoid pte allocation with GFP_KERNEL 1127 - * in non-preemtible context of zs_map_object. 1128 - */ 1129 - return apply_to_page_range(&init_mm, (unsigned long)area->vm->addr, 1130 - PAGE_SIZE * 2, NULL, NULL); 1131 - } 1132 - 1133 - static inline void __zs_cpu_down(struct mapping_area *area) 1134 - { 1135 - if (area->vm) 1136 - free_vm_area(area->vm); 1137 - area->vm = NULL; 1138 - } 1139 - 1140 - static inline void *__zs_map_object(struct mapping_area *area, 1141 - struct page *pages[2], int off, int size) 1142 - { 1143 - unsigned long addr = (unsigned long)area->vm->addr; 1144 - 1145 - BUG_ON(map_kernel_range(addr, PAGE_SIZE * 2, PAGE_KERNEL, pages) < 0); 1146 - area->vm_addr = area->vm->addr; 1147 - return area->vm_addr + off; 1148 - } 1149 - 1150 - static inline void __zs_unmap_object(struct mapping_area *area, 1151 - struct page *pages[2], int off, int size) 1152 - { 1153 - unsigned long addr = (unsigned long)area->vm_addr; 1154 - 1155 - unmap_kernel_range(addr, PAGE_SIZE * 2); 1156 - } 1157 - 1158 - #else /* CONFIG_ZSMALLOC_PGTABLE_MAPPING */ 1159 - 1160 1116 static inline int __zs_cpu_up(struct mapping_area *area) 1161 1117 { 1162 1118 /* ··· 1188 1240 /* enable page faults to match kunmap_atomic() return conditions */ 1189 1241 pagefault_enable(); 1190 1242 } 1191 - 1192 - #endif /* CONFIG_ZSMALLOC_PGTABLE_MAPPING */ 1193 1243 1194 1244 static int zs_cpu_prepare(unsigned int cpu) 1195 1245 {
+4
tools/testing/selftests/vm/Makefile
··· 60 60 TEST_GEN_FILES += $(BINARIES_64) 61 61 endif 62 62 else 63 + 64 + ifneq (,$(findstring $(ARCH),powerpc)) 63 65 TEST_GEN_FILES += protection_keys 66 + endif 67 + 64 68 endif 65 69 66 70 ifneq (,$(filter $(MACHINE),arm64 ia64 mips64 parisc64 ppc64 ppc64le riscv64 s390x sh64 sparc64 x86_64))
+16 -9
tools/testing/selftests/vm/userfaultfd.c
··· 206 206 return ret; 207 207 } 208 208 209 - 210 209 static void hugetlb_allocate_area(void **alloc_area) 211 210 { 212 211 void *area_alias = NULL; 213 212 char **alloc_area_alias; 213 + 214 214 *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, 215 215 (map_shared ? MAP_SHARED : MAP_PRIVATE) | 216 216 MAP_HUGETLB, 217 217 huge_fd, *alloc_area == area_src ? 0 : 218 218 nr_pages * page_size); 219 219 if (*alloc_area == MAP_FAILED) { 220 - fprintf(stderr, "mmap of hugetlbfs file failed\n"); 221 - *alloc_area = NULL; 220 + perror("mmap of hugetlbfs file failed"); 221 + goto fail; 222 222 } 223 223 224 224 if (map_shared) { ··· 227 227 huge_fd, *alloc_area == area_src ? 0 : 228 228 nr_pages * page_size); 229 229 if (area_alias == MAP_FAILED) { 230 - if (munmap(*alloc_area, nr_pages * page_size) < 0) { 231 - perror("hugetlb munmap"); 232 - exit(1); 233 - } 234 - *alloc_area = NULL; 235 - return; 230 + perror("mmap of hugetlb file alias failed"); 231 + goto fail_munmap; 236 232 } 237 233 } 234 + 238 235 if (*alloc_area == area_src) { 239 236 huge_fd_off0 = *alloc_area; 240 237 alloc_area_alias = &area_src_alias; ··· 240 243 } 241 244 if (area_alias) 242 245 *alloc_area_alias = area_alias; 246 + 247 + return; 248 + 249 + fail_munmap: 250 + if (munmap(*alloc_area, nr_pages * page_size) < 0) { 251 + perror("hugetlb munmap"); 252 + exit(1); 253 + } 254 + fail: 255 + *alloc_area = NULL; 243 256 } 244 257 245 258 static void hugetlb_alias_mapping(__u64 *start, size_t len, unsigned long offset)