Message ID | 20180607150546.1c7db21f70221008e14b8bb8@linux-foundation.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Jun 07, 2018 at 03:05:46PM -0700, Andrew Morton wrote: > [akpm@linux-foundation.org: add comment] Can I fix the comment? ;-) > @@ -440,6 +440,14 @@ static __latent_entropy int dup_mmap(str > continue; > } > charge = 0; > + /* > + * Don't duplicate many vmas if we've been oom-killed (for > + * example) > + */ /* * No point in continuing if we're just going to die at * the end of the fork. This may happen due to being OOM. */ > + if (fatal_signal_pending(current)) { > + retval = -EINTR; > + goto out; > + } Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
diff -puN kernel/fork.c~mm-check-for-sigkill-inside-dup_mmap-loop kernel/fork.c --- a/kernel/fork.c~mm-check-for-sigkill-inside-dup_mmap-loop +++ a/kernel/fork.c @@ -440,6 +440,14 @@ static __latent_entropy int dup_mmap(str continue; } charge = 0; + /* + * Don't duplicate many vmas if we've been oom-killed (for + * example) + */ + if (fatal_signal_pending(current)) { + retval = -EINTR; + goto out; + } if (mpnt->vm_flags & VM_ACCOUNT) { unsigned long len = vma_pages(mpnt);