X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=mm%2Fmmu_context.c;h=9e82e937000e19f8210b10886457a3d82ee0870b;hb=694a98073f83ce1c14e3c0bba182bfeba5c44f01;hp=fd473b51c90372244c3acd1c9f1cffcb494cd451;hpb=3d2d827f5ca5e32816194119d5c980c7e04474a6;p=safe%2Fjmp%2Flinux-2.6 diff --git a/mm/mmu_context.c b/mm/mmu_context.c index fd473b5..9e82e93 100644 --- a/mm/mmu_context.c +++ b/mm/mmu_context.c @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -26,14 +27,18 @@ void use_mm(struct mm_struct *mm) task_lock(tsk); active_mm = tsk->active_mm; - atomic_inc(&mm->mm_count); + if (active_mm != mm) { + atomic_inc(&mm->mm_count); + tsk->active_mm = mm; + } tsk->mm = mm; - tsk->active_mm = mm; switch_mm(active_mm, mm, tsk); task_unlock(tsk); - mmdrop(active_mm); + if (active_mm != mm) + mmdrop(active_mm); } +EXPORT_SYMBOL_GPL(use_mm); /* * unuse_mm @@ -48,8 +53,10 @@ void unuse_mm(struct mm_struct *mm) struct task_struct *tsk = current; task_lock(tsk); + sync_mm_rss(tsk, mm); tsk->mm = NULL; /* active_mm is still 'mm' */ enter_lazy_tlb(mm, tsk); task_unlock(tsk); } +EXPORT_SYMBOL_GPL(unuse_mm);