[PATCH 2/3] mm/tlb: Remove tlb_remove_table() non-concurrent condition

Tyler Hicks tyhicks at canonical.com
Fri Oct 19 22:38:20 UTC 2018

From: Peter Zijlstra <peterz at infradead.org>

BugLink: https://launchpad.net/bugs/1798897

Will noted that only checking mm_users is incorrect; we should also
check mm_count in order to cover CPUs that have a lazy reference to
this mm (and could do speculative TLB operations).

If removing this turns out to be a performance issue, we can
re-instate a more complete check, but in tlb_table_flush() eliding the

Fixes: 267239116987 ("mm, powerpc: move the RCU page-table freeing into generic code")
Reported-by: Will Deacon <will.deacon at arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz at infradead.org>
Acked-by: Rik van Riel <riel at surriel.com>
Acked-by: Will Deacon <will.deacon at arm.com>
Cc: Nicholas Piggin <npiggin at gmail.com>
Cc: David Miller <davem at davemloft.net>
Cc: Martin Schwidefsky <schwidefsky at de.ibm.com>
Cc: Michael Ellerman <mpe at ellerman.id.au>
Cc: stable at kernel.org
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
(cherry picked from commit a6f572084fbee8b30f91465f4a085d7a90901c57)
Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
 mm/memory.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index c5928cda7748..b991e87d0bf1 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -376,15 +376,6 @@ void tlb_remove_table(struct mmu_gather *tlb, void *table)
 	struct mmu_table_batch **batch = &tlb->batch;
-	/*
-	 * When there's less then two users of this mm there cannot be a
-	 * concurrent page-table walk.
-	 */
-	if (atomic_read(&tlb->mm->mm_users) < 2) {
-		__tlb_remove_table(table);
-		return;
-	}
 	if (*batch == NULL) {
 		*batch = (struct mmu_table_batch *)__get_free_page(GFP_NOWAIT | __GFP_NOWARN);
 		if (*batch == NULL) {

More information about the kernel-team mailing list