1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #include <linux/mm.h>
- #include <linux/sched.h>
- #include <linux/mmu_context.h>
- #include <linux/export.h>
- #include <asm/mmu_context.h>
- void use_mm(struct mm_struct *mm)
- {
- struct mm_struct *active_mm;
- struct task_struct *tsk = current;
- task_lock(tsk);
- active_mm = tsk->active_mm;
- if (active_mm != mm) {
- atomic_inc(&mm->mm_count);
- tsk->active_mm = mm;
- }
- tsk->mm = mm;
- switch_mm(active_mm, mm, tsk);
- task_unlock(tsk);
- #ifdef finish_arch_post_lock_switch
- finish_arch_post_lock_switch();
- #endif
- if (active_mm != mm)
- mmdrop(active_mm);
- }
- EXPORT_SYMBOL_GPL(use_mm);
- void unuse_mm(struct mm_struct *mm)
- {
- struct task_struct *tsk = current;
- task_lock(tsk);
- sync_mm_rss(mm);
- tsk->mm = NULL;
-
- enter_lazy_tlb(mm, tsk);
- task_unlock(tsk);
- }
- EXPORT_SYMBOL_GPL(unuse_mm);
|