On Thu, Jun 28, 2012 at 9:20 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> 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@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>