On Wed, Jun 27, 2012 at 4:13 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > > That triggered.. is this a problem though, at this point userspace is > very dead so it shouldn't matter, right? It still matters. Even if user space is dead, kernel space accesses can result in TLB fills in user space. Exactly because of things like speculative fills etc. So what can happen - for example - is that the kernel does a indirect jump, and the CPU predicts the destination of the jump that using the branch prediction tables. But the branch prediction tables are obviously just predictions, and they easily contain user addresses etc in them. So the kernel may well end up speculatively doing a TLB fill on a user access. And your whole optimization depends on this not happening, unless I read the logic wrong. The whole "invalidate the TLB just once up-front" approach is *only* valid if you know that nothing is going to ever fill that TLB again. But see above - if we're still running within that TLB context, we have no idea what speculative execution may or may not end up filling. That said, maybe I misread your patch? 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>