]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/x86/include/asm/mmu_context.h
Merge tag 'dmaengine-3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw...
[karo-tx-linux.git] / arch / x86 / include / asm / mmu_context.h
index cdbf36776106addf6eec8770b50d156b448b5185..be12c534fd592e84fd81ca0b3b6c5182ecb2f6fe 100644 (file)
@@ -45,22 +45,28 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
                /* Re-load page tables */
                load_cr3(next->pgd);
 
-               /* stop flush ipis for the previous mm */
+               /* Stop flush ipis for the previous mm */
                cpumask_clear_cpu(cpu, mm_cpumask(prev));
 
-               /*
-                * load the LDT, if the LDT is different:
-                */
+               /* Load the LDT, if the LDT is different: */
                if (unlikely(prev->context.ldt != next->context.ldt))
                        load_LDT_nolock(&next->context);
        }
 #ifdef CONFIG_SMP
-       else {
+         else {
                this_cpu_write(cpu_tlbstate.state, TLBSTATE_OK);
                BUG_ON(this_cpu_read(cpu_tlbstate.active_mm) != next);
 
-               if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next))) {
-                       /* We were in lazy tlb mode and leave_mm disabled
+               if (!cpumask_test_cpu(cpu, mm_cpumask(next))) {
+                       /*
+                        * On established mms, the mm_cpumask is only changed
+                        * from irq context, from ptep_clear_flush() while in
+                        * lazy tlb mode, and here. Irqs are blocked during
+                        * schedule, protecting us from simultaneous changes.
+                        */
+                       cpumask_set_cpu(cpu, mm_cpumask(next));
+                       /*
+                        * We were in lazy tlb mode and leave_mm disabled
                         * tlb flush IPI delivery. We must reload CR3
                         * to make sure to use no freed page tables.
                         */