Thread (24 messages) 24 messages, 3 authors, 2021-06-17

Re: [PATCH v4 1/4] lazy tlb: introduce lazy mm refcount helper functions

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2021-06-07 23:49:44
Also in: linux-arch, linux-mm, lkml

On Sat,  5 Jun 2021 11:42:13 +1000 Nicholas Piggin [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Add explicit _lazy_tlb annotated functions for lazy mm refcounting.
This makes lazy mm references more obvious, and allows explicit
refcounting to be removed if it is not used.

...
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -1314,14 +1314,14 @@ void kthread_use_mm(struct mm_struct *mm)
 	WARN_ON_ONCE(!(tsk->flags & PF_KTHREAD));
 	WARN_ON_ONCE(tsk->mm);
 
+	mmgrab(mm);
+
 	task_lock(tsk);
 	/* Hold off tlb flush IPIs while switching mm's */
 	local_irq_disable();
 	active_mm = tsk->active_mm;
-	if (active_mm != mm) {
-		mmgrab(mm);
+	if (active_mm != mm)
 		tsk->active_mm = mm;
-	}
Looks like a functional change.  What's happening here?

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help