Merge branch 'pm-cpuidle'
[muen/linux.git] / drivers / idle / intel_idle.c
index 9c93abdf635fe84ff3f64b4d60ac7a0203c34514..b2ccce5fb0718303971dec46581482ff1d2e7e76 100644 (file)
@@ -914,13 +914,14 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,
        unsigned long eax = flg2MWAIT(state->flags);
        unsigned int cstate;
        bool uninitialized_var(tick);
+       int cpu = smp_processor_id();
 
        /*
-        * NB: if CPUIDLE_FLAG_TLB_FLUSHED is set, this idle transition
-        * will probably flush the TLB.  It's not guaranteed to flush
-        * the TLB, though, so it's not clear that we can do anything
-        * useful with this knowledge.
+        * leave_mm() to avoid costly and often unnecessary wakeups
+        * for flushing the user TLB's associated with the active mm.
         */
+       if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED)
+               leave_mm(cpu);
 
        if (!static_cpu_has(X86_FEATURE_ARAT)) {
                cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) &