@@ -476,7 +476,7 @@ static void exit_mm(void)
/* more a memory barrier than a real lock */
task_lock(current);
current->mm = NULL;
- mmgrab(mm); /* for current->exit_mm */
+ mm_ref(mm); /* for current->exit_mm */
current->exit_mm = mm;
mmap_read_unlock(mm);
enter_lazy_tlb(mm, current);
@@ -720,7 +720,7 @@ void free_task(struct task_struct *tsk)
if (tsk->flags & PF_KTHREAD)
free_kthread_struct(tsk);
if (tsk->exit_mm)
- mmdrop_async(tsk->exit_mm);
+ mm_unref(tsk->exit_mm);
free_task_struct(tsk);
}
EXPORT_SYMBOL(free_task);
We only use ->exit_mm to look up dumpability and the ->user_mm; we don't need to keep the PGD alive for this. mmgrab() is also inconvenient here, because it means that we need to use mmdrop_async() when dropping the reference to the mm from an RCU callback. Use mm_ref() instead of mmgrab() to make things neater. Signed-off-by: Jann Horn <jannh@google.com> --- kernel/exit.c | 2 +- kernel/fork.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)