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.

mm: use vma_start_write_killable() in dup_mmap()

Allow waiting for the VMA write lock to be interrupted by fatal signals.
The explicit check for fatal_signal_pending() can be removed as it is
checked during vma_start_write_killable(). Improves the latency of
killing the task as we do not wait for the reader to finish before
checking for signals.

Link: https://lkml.kernel.org/r/20251110203204.1454057-3-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Chris Li <chriscli@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
7370f8e1 2197bb60

+3 -9
+3 -9
mm/mmap.c
··· 1747 1747 for_each_vma(vmi, mpnt) { 1748 1748 struct file *file; 1749 1749 1750 - vma_start_write(mpnt); 1750 + retval = vma_start_write_killable(mpnt); 1751 + if (retval < 0) 1752 + goto loop_out; 1751 1753 if (mpnt->vm_flags & VM_DONTCOPY) { 1752 1754 retval = vma_iter_clear_gfp(&vmi, mpnt->vm_start, 1753 1755 mpnt->vm_end, GFP_KERNEL); ··· 1760 1758 continue; 1761 1759 } 1762 1760 charge = 0; 1763 - /* 1764 - * Don't duplicate many vmas if we've been oom-killed (for 1765 - * example) 1766 - */ 1767 - if (fatal_signal_pending(current)) { 1768 - retval = -EINTR; 1769 - goto loop_out; 1770 - } 1771 1761 if (mpnt->vm_flags & VM_ACCOUNT) { 1772 1762 unsigned long len = vma_pages(mpnt); 1773 1763