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 tag 'mm-hotfixes-stable-2023-09-05-11-51' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull misc fixes from Andrew Morton:
"Seven hotfixes. Four are cc:stable and the remainder pertain to issues
which were introduced in the current merge window"

* tag 'mm-hotfixes-stable-2023-09-05-11-51' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
sparc64: add missing initialization of folio in tlb_batch_add()
mm: memory-failure: use rcu lock instead of tasklist_lock when collect_procs()
revert "memfd: improve userspace warnings for missing exec-related flags".
rcu: dump vmalloc memory info safely
mm/vmalloc: add a safer version of find_vm_area() for debug
tools/mm: fix undefined reference to pthread_once
memcontrol: ensure memcg acquired by id is properly set up

+56 -26
+1
arch/sparc/mm/tlb.c
··· 128 128 goto no_cache_flush; 129 129 130 130 /* A real file page? */ 131 + folio = page_folio(page); 131 132 mapping = folio_flush_mapping(folio); 132 133 if (!mapping) 133 134 goto no_cache_flush;
-3
mm/filemap.c
··· 121 121 * bdi.wb->list_lock (zap_pte_range->set_page_dirty) 122 122 * ->inode->i_lock (zap_pte_range->set_page_dirty) 123 123 * ->private_lock (zap_pte_range->block_dirty_folio) 124 - * 125 - * ->i_mmap_rwsem 126 - * ->tasklist_lock (memory_failure, collect_procs_ao) 127 124 */ 128 125 129 126 static void page_cache_delete(struct address_space *mapping,
+2 -2
mm/ksm.c
··· 2925 2925 struct anon_vma *av = rmap_item->anon_vma; 2926 2926 2927 2927 anon_vma_lock_read(av); 2928 - read_lock(&tasklist_lock); 2928 + rcu_read_lock(); 2929 2929 for_each_process(tsk) { 2930 2930 struct anon_vma_chain *vmac; 2931 2931 unsigned long addr; ··· 2944 2944 } 2945 2945 } 2946 2946 } 2947 - read_unlock(&tasklist_lock); 2947 + rcu_read_unlock(); 2948 2948 anon_vma_unlock_read(av); 2949 2949 } 2950 2950 }
+17 -5
mm/memcontrol.c
··· 5326 5326 INIT_LIST_HEAD(&memcg->deferred_split_queue.split_queue); 5327 5327 memcg->deferred_split_queue.split_queue_len = 0; 5328 5328 #endif 5329 - idr_replace(&mem_cgroup_idr, memcg, memcg->id.id); 5330 5329 lru_gen_init_memcg(memcg); 5331 5330 return memcg; 5332 5331 fail: ··· 5397 5398 if (alloc_shrinker_info(memcg)) 5398 5399 goto offline_kmem; 5399 5400 5400 - /* Online state pins memcg ID, memcg ID pins CSS */ 5401 - refcount_set(&memcg->id.ref, 1); 5402 - css_get(css); 5403 - 5404 5401 if (unlikely(mem_cgroup_is_root(memcg))) 5405 5402 queue_delayed_work(system_unbound_wq, &stats_flush_dwork, 5406 5403 FLUSH_TIME); 5407 5404 lru_gen_online_memcg(memcg); 5405 + 5406 + /* Online state pins memcg ID, memcg ID pins CSS */ 5407 + refcount_set(&memcg->id.ref, 1); 5408 + css_get(css); 5409 + 5410 + /* 5411 + * Ensure mem_cgroup_from_id() works once we're fully online. 5412 + * 5413 + * We could do this earlier and require callers to filter with 5414 + * css_tryget_online(). But right now there are no users that 5415 + * need earlier access, and the workingset code relies on the 5416 + * cgroup tree linkage (mem_cgroup_get_nr_swap_pages()). So 5417 + * publish it here at the end of onlining. This matches the 5418 + * regular ID destruction during offlining. 5419 + */ 5420 + idr_replace(&mem_cgroup_idr, memcg, memcg->id.id); 5421 + 5408 5422 return 0; 5409 5423 offline_kmem: 5410 5424 memcg_offline_kmem(memcg);
+1 -1
mm/memfd.c
··· 316 316 return -EINVAL; 317 317 318 318 if (!(flags & (MFD_EXEC | MFD_NOEXEC_SEAL))) { 319 - pr_info_ratelimited( 319 + pr_warn_once( 320 320 "%s[%d]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set\n", 321 321 current->comm, task_pid_nr(current)); 322 322 }
+8 -8
mm/memory-failure.c
··· 547 547 * on behalf of the thread group. Return task_struct of the (first found) 548 548 * dedicated thread if found, and return NULL otherwise. 549 549 * 550 - * We already hold read_lock(&tasklist_lock) in the caller, so we don't 551 - * have to call rcu_read_lock/unlock() in this function. 550 + * We already hold rcu lock in the caller, so we don't have to call 551 + * rcu_read_lock/unlock() in this function. 552 552 */ 553 553 static struct task_struct *find_early_kill_thread(struct task_struct *tsk) 554 554 { ··· 609 609 return; 610 610 611 611 pgoff = page_to_pgoff(page); 612 - read_lock(&tasklist_lock); 612 + rcu_read_lock(); 613 613 for_each_process(tsk) { 614 614 struct anon_vma_chain *vmac; 615 615 struct task_struct *t = task_early_kill(tsk, force_early); ··· 626 626 add_to_kill_anon_file(t, page, vma, to_kill); 627 627 } 628 628 } 629 - read_unlock(&tasklist_lock); 629 + rcu_read_unlock(); 630 630 anon_vma_unlock_read(av); 631 631 } 632 632 ··· 642 642 pgoff_t pgoff; 643 643 644 644 i_mmap_lock_read(mapping); 645 - read_lock(&tasklist_lock); 645 + rcu_read_lock(); 646 646 pgoff = page_to_pgoff(page); 647 647 for_each_process(tsk) { 648 648 struct task_struct *t = task_early_kill(tsk, force_early); ··· 662 662 add_to_kill_anon_file(t, page, vma, to_kill); 663 663 } 664 664 } 665 - read_unlock(&tasklist_lock); 665 + rcu_read_unlock(); 666 666 i_mmap_unlock_read(mapping); 667 667 } 668 668 ··· 685 685 struct task_struct *tsk; 686 686 687 687 i_mmap_lock_read(mapping); 688 - read_lock(&tasklist_lock); 688 + rcu_read_lock(); 689 689 for_each_process(tsk) { 690 690 struct task_struct *t = task_early_kill(tsk, true); 691 691 ··· 696 696 add_to_kill_fsdax(t, page, vma, to_kill, pgoff); 697 697 } 698 698 } 699 - read_unlock(&tasklist_lock); 699 + rcu_read_unlock(); 700 700 i_mmap_unlock_read(mapping); 701 701 } 702 702 #endif /* CONFIG_FS_DAX */
+3 -1
mm/util.c
··· 1068 1068 if (vmalloc_dump_obj(object)) 1069 1069 return; 1070 1070 1071 - if (virt_addr_valid(object)) 1071 + if (is_vmalloc_addr(object)) 1072 + type = "vmalloc memory"; 1073 + else if (virt_addr_valid(object)) 1072 1074 type = "non-slab/vmalloc memory"; 1073 1075 else if (object == NULL) 1074 1076 type = "NULL pointer";
+22 -4
mm/vmalloc.c
··· 4278 4278 #ifdef CONFIG_PRINTK 4279 4279 bool vmalloc_dump_obj(void *object) 4280 4280 { 4281 - struct vm_struct *vm; 4282 4281 void *objp = (void *)PAGE_ALIGN((unsigned long)object); 4282 + const void *caller; 4283 + struct vm_struct *vm; 4284 + struct vmap_area *va; 4285 + unsigned long addr; 4286 + unsigned int nr_pages; 4283 4287 4284 - vm = find_vm_area(objp); 4285 - if (!vm) 4288 + if (!spin_trylock(&vmap_area_lock)) 4286 4289 return false; 4290 + va = __find_vmap_area((unsigned long)objp, &vmap_area_root); 4291 + if (!va) { 4292 + spin_unlock(&vmap_area_lock); 4293 + return false; 4294 + } 4295 + 4296 + vm = va->vm; 4297 + if (!vm) { 4298 + spin_unlock(&vmap_area_lock); 4299 + return false; 4300 + } 4301 + addr = (unsigned long)vm->addr; 4302 + caller = vm->caller; 4303 + nr_pages = vm->nr_pages; 4304 + spin_unlock(&vmap_area_lock); 4287 4305 pr_cont(" %u-page vmalloc region starting at %#lx allocated at %pS\n", 4288 - vm->nr_pages, (unsigned long)vm->addr, vm->caller); 4306 + nr_pages, addr, caller); 4289 4307 return true; 4290 4308 } 4291 4309 #endif
+2 -2
tools/mm/Makefile
··· 8 8 LIB_DIR = ../lib/api 9 9 LIBS = $(LIB_DIR)/libapi.a 10 10 11 - CFLAGS += -Wall -Wextra -I../lib/ 12 - LDFLAGS += $(LIBS) 11 + CFLAGS += -Wall -Wextra -I../lib/ -pthread 12 + LDFLAGS += $(LIBS) -pthread 13 13 14 14 all: $(TARGETS) 15 15