diff options
-rw-r--r-- | fs/aio.c | 4 | ||||
-rw-r--r-- | include/asm-um/mmu_context.h | 10 |
2 files changed, 13 insertions, 1 deletions
@@ -567,6 +567,10 @@ static void use_mm(struct mm_struct *mm) | |||
567 | atomic_inc(&mm->mm_count); | 567 | atomic_inc(&mm->mm_count); |
568 | tsk->mm = mm; | 568 | tsk->mm = mm; |
569 | tsk->active_mm = mm; | 569 | tsk->active_mm = mm; |
570 | /* | ||
571 | * Note that on UML this *requires* PF_BORROWED_MM to be set, otherwise | ||
572 | * it won't work. Update it accordingly if you change it here | ||
573 | */ | ||
570 | activate_mm(active_mm, mm); | 574 | activate_mm(active_mm, mm); |
571 | task_unlock(tsk); | 575 | task_unlock(tsk); |
572 | 576 | ||
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h index 095bb627b96a..2edb4f1f789c 100644 --- a/include/asm-um/mmu_context.h +++ b/include/asm-um/mmu_context.h | |||
@@ -20,7 +20,15 @@ extern void force_flush_all(void); | |||
20 | 20 | ||
21 | static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) | 21 | static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) |
22 | { | 22 | { |
23 | if (old != new) | 23 | /* |
24 | * This is called by fs/exec.c and fs/aio.c. In the first case, for an | ||
25 | * exec, we don't need to do anything as we're called from userspace | ||
26 | * and thus going to use a new host PID. In the second, we're called | ||
27 | * from a kernel thread, and thus need to go doing the mmap's on the | ||
28 | * host. Since they're very expensive, we want to avoid that as far as | ||
29 | * possible. | ||
30 | */ | ||
31 | if (old != new && (current->flags & PF_BORROWED_MM)) | ||
24 | force_flush_all(); | 32 | force_flush_all(); |
25 | } | 33 | } |
26 | 34 | ||