From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx174.postini.com [74.125.245.174]) by kanga.kvack.org (Postfix) with SMTP id 5DAAA6B005A for ; Wed, 27 Jun 2012 17:41:14 -0400 (EDT) Message-Id: <20120627212831.137126018@chello.nl> Date: Wed, 27 Jun 2012 23:15:48 +0200 From: Peter Zijlstra Subject: [PATCH 08/20] mm: Optimize fullmm TLB flushing References: <20120627211540.459910855@chello.nl> Content-Disposition: inline; filename=mmu_gather_fullmm.patch Sender: owner-linux-mm@kvack.org List-ID: To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Thomas Gleixner , Ingo Molnar , akpm@linux-foundation.org, Linus Torvalds , Rik van Riel , Hugh Dickins , Mel Gorman , Nick Piggin , Alex Shi , "Nikunj A. Dadhania" , Konrad Rzeszutek Wilk , Peter Zijlstra , Benjamin Herrenschmidt , David Miller , Russell King , Catalin Marinas , Chris Metcalf , Martin Schwidefsky , Tony Luck , Paul Mundt , Jeff Dike , Richard Weinberger , Hans-Christian Egtvedt , Ralf Baechle , Kyle McMartin , James Bottomley , Chris Zankel This originated from s390 which does something similar and would allow s390 to use the generic TLB flushing code. The idea is to flush the mm wide cache and tlb a priory and not bother with multiple flushes if the batching isn't large enough. This can be safely done since there cannot be any concurrency on this mm, its either after the process died (exit) or in the middle of execve where the thread switched to the new mm. Cc: Martin Schwidefsky Signed-off-by: Peter Zijlstra --- mm/memory.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/mm/memory.c +++ b/mm/memory.c @@ -215,16 +215,22 @@ void tlb_gather_mmu(struct mmu_gather *t tlb->active = &tlb->local; tlb_table_init(tlb); + + if (fullmm) { + flush_cache_mm(mm); + flush_tlb_mm(mm); + } } void tlb_flush_mmu(struct mmu_gather *tlb) { struct mmu_gather_batch *batch; - if (!tlb->need_flush) - return; - tlb->need_flush = 0; - flush_tlb_mm(tlb->mm); + if (!tlb->fullmm && tlb->need_flush) { + tlb->need_flush = 0; + flush_tlb_mm(tlb->mm); + } + tlb_table_flush(tlb); if (tlb_fast_mode(tlb)) -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org