Subject: linux-next: manual merge of the akpm-current tree with the userns tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 11 Oct 2021 17:41:03 +1100

Hi all,

Today's linux-next merge of the akpm-current tree got a conflict in:

  kernel/exit.c

between commits:

  d67e03e36161 ("exit: Factor coredump_exit_mm out of exit_mm")
  92307383082d ("coredump:  Don't perform any cleanups before dumping core")

from the userns tree and commit:

  27692e64c49c ("lazy tlb: introduce lazy mm refcount helper functions")

from the akpm-current tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc kernel/exit.c
index f702a6a63686,8e7b41702ad6..000000000000
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@@ -480,8 -440,42 +480,8 @@@ static void exit_mm(void
  	if (!mm)
  		return;
  	sync_mm_rss(mm);
 -	/*
 -	 * Serialize with any possible pending coredump.
 -	 * We must hold mmap_lock around checking core_state
 -	 * and clearing tsk->mm.  The core-inducing thread
 -	 * will increment ->nr_threads for each thread in the
 -	 * group with ->mm != NULL.
 -	 */
  	mmap_read_lock(mm);
- 	mmgrab(mm);
 -	core_state = mm->core_state;
 -	if (core_state) {
 -		struct core_thread self;
 -
 -		mmap_read_unlock(mm);
 -
 -		self.task = current;
 -		if (self.task->flags & PF_SIGNALED)
 -			self.next = xchg(&core_state->dumper.next, &self);
 -		else
 -			self.task = NULL;
 -		/*
 -		 * Implies mb(), the result of xchg() must be visible
 -		 * to core_state->dumper.
 -		 */
 -		if (atomic_dec_and_test(&core_state->nr_threads))
 -			complete(&core_state->startup);
 -
 -		for (;;) {
 -			set_current_state(TASK_UNINTERRUPTIBLE);
 -			if (!self.task) /* see coredump_finish() */
 -				break;
 -			freezable_schedule();
 -		}
 -		__set_current_state(TASK_RUNNING);
 -		mmap_read_lock(mm);
 -	}
+ 	mmgrab_lazy_tlb(mm);
  	BUG_ON(mm != current->active_mm);
  	/* more a memory barrier than a real lock */
  	task_lock(current);