X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fasm-um%2Fmmu_context.h;h=f709c784bf1296e21de0a33175e403e86a974df6;hb=af57d238aa2107e1b45d8dacad6e50db938f0567;hp=095bb627b96a1d52be4cc1291f48c308449f65a1;hpb=b857c730d4e960d1876ff56ce5c4bd81ea9ff5ae;p=linux-2.6 diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h index 095bb627b9..f709c784bf 100644 --- a/include/asm-um/mmu_context.h +++ b/include/asm-um/mmu_context.h @@ -7,7 +7,6 @@ #define __UM_MMU_CONTEXT_H #include "linux/sched.h" -#include "linux/config.h" #include "choose-mode.h" #include "um_mmu.h" @@ -20,8 +19,17 @@ extern void force_flush_all(void); static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) { - if (old != new) - force_flush_all(); + /* + * This is called by fs/exec.c and fs/aio.c. In the first case, for an + * exec, we don't need to do anything as we're called from userspace + * and thus going to use a new host PID. In the second, we're called + * from a kernel thread, and thus need to go doing the mmap's on the + * host. Since they're very expensive, we want to avoid that as far as + * possible. + */ + if (old != new && (current->flags & PF_BORROWED_MM)) + CHOOSE_MODE(force_flush_all(), + switch_mm_skas(&new->context.skas.id)); } static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,