Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fce371b authored by Vegard Nossum's avatar Vegard Nossum Committed by Linus Torvalds
Browse files

mm: add new mmget() helper

Apart from adding the helper function itself, the rest of the kernel is
converted mechanically using:

  git grep -l 'atomic_inc.*mm_users' | xargs sed -i 's/atomic_inc(&\(.*\)->mm_users);/mmget\(\1\);/'
  git grep -l 'atomic_inc.*mm_users' | xargs sed -i 's/atomic_inc(&\(.*\)\.mm_users);/mmget\(\&\1\);/'

This is needed for a later patch that hooks into the helper, but might
be a worthwhile cleanup on its own.

(Michal Hocko provided most of the kerneldoc comment.)

Link: http://lkml.kernel.org/r/20161218123229.22952-2-vegard.nossum@oracle.com


Signed-off-by: default avatarVegard Nossum <vegard.nossum@oracle.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f1f10076
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ void start_kernel_secondary(void)
	/* MMU, Caches, Vector Table, Interrupts etc */
	setup_processor();

	atomic_inc(&mm->mm_users);
	mmget(mm);
	mmgrab(mm);
	current->active_mm = mm;
	cpumask_set_cpu(cpu, mm_cpumask(mm));
+1 −1
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ void secondary_start_kernel(void)
	local_irq_disable();

	/* Attach the new idle task to the global mm. */
	atomic_inc(&mm->mm_users);
	mmget(mm);
	mmgrab(mm);
	current->active_mm = mm;

+1 −1
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ int cxn_pin_by_pid(pid_t pid)
		task_lock(tsk);
		if (tsk->mm) {
			mm = tsk->mm;
			atomic_inc(&mm->mm_users);
			mmget(mm);
			ret = 0;
		}
		task_unlock(tsk);
+1 −1
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ asmlinkage void secondary_start_kernel(void)
	 * All kernel threads share the same mm context; grab a
	 * reference and switch to it.
	 */
	atomic_inc(&mm->mm_users);
	mmget(mm);
	mmgrab(mm);
	current->active_mm = mm;
	cpumask_set_cpu(cpu, mm_cpumask(mm));
+1 −1
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ asmlinkage void start_secondary(void)

	enable_mmu();
	mmgrab(mm);
	atomic_inc(&mm->mm_users);
	mmget(mm);
	current->active_mm = mm;
#ifdef CONFIG_MMU
	enter_lazy_tlb(mm, current);
Loading