From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx166.postini.com [74.125.245.166]) by kanga.kvack.org (Postfix) with SMTP id 918BE6B0075 for ; Thu, 28 Jun 2012 12:45:32 -0400 (EDT) Received: by wibhm2 with SMTP id hm2so299352wib.2 for ; Thu, 28 Jun 2012 09:45:30 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1340900425.28750.73.camel@twins> References: <20120627211540.459910855@chello.nl> <20120627212831.137126018@chello.nl> <1340838154.10063.86.camel@twins> <1340838807.10063.90.camel@twins> <20120628091627.GB8573@arm.com> <1340879984.20977.80.camel@pasglop> <1340881196.28750.16.camel@twins> <20120628145327.GA17242@arm.com> <1340900425.28750.73.camel@twins> From: Linus Torvalds Date: Thu, 28 Jun 2012 09:45:10 -0700 Message-ID: Subject: Re: [PATCH 08/20] mm: Optimize fullmm TLB flushing Content-Type: text/plain; charset=ISO-8859-1 Sender: owner-linux-mm@kvack.org List-ID: To: Peter Zijlstra Cc: Catalin Marinas , Benjamin Herrenschmidt , "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-mm@kvack.org" , Thomas Gleixner , Ingo Molnar , "akpm@linux-foundation.org" , Rik van Riel , Hugh Dickins , Mel Gorman , Nick Piggin , Alex Shi , "Nikunj A. Dadhania" , Konrad Rzeszutek Wilk , David Miller , Russell King , Chris Metcalf , Martin Schwidefsky , Tony Luck , Paul Mundt , Jeff Dike , Richard Weinberger , Ralf Baechle , Kyle McMartin , James Bottomley , Chris Zankel On Thu, Jun 28, 2012 at 9:20 AM, Peter Zijlstra wrote: > > How horrid is something like the below. It detaches the mm so that > hardware speculation simply doesn't matter. Actually, that's wrong. Even when detached, kernel threads may still use that mm lazily. Now, that only happens on other CPU's (if any scheduling happens on *this* CPU, they will lazily take the mm of the thread it scheduled away from), but even if you detach the VM that doesn't mean that hardware speculation wouldn't matter. Kernel threads on other CPU's may still be doing TLB accesses. Of course, I *think* that if we do an IPI on the thing, we also kick those kernel threads out of using that mm. So it may actually work if you also do that explicit TLB flush to make sure other CPU's don't have this MM. I don't think switch_mm() does that for you, it only does a local-cpu invalidate. I didn't look at the code, though. Maybe I'm wrong in thinking that you are wrong. Linus -- 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