void flush_thread(void) { void *data = NULL; int ret; arch_flush_thread(¤t->thread.arch); ret = unmap(¤t->mm->context.id, 0, STUB_START, 0, &data); ret = ret || unmap(¤t->mm->context.id, STUB_END, host_task_size - STUB_END, 1, &data); if (ret) { printk(KERN_ERR "flush_thread - clearing address space failed, " "err = %d\n", ret); force_sig(SIGKILL, current); } __switch_mm(¤t->mm->context.id); }
/* * use_mm * Makes the calling kernel thread take on the specified * mm context. * Called by the retry thread execute retries within the * iocb issuer's mm context, so that copy_from/to_user * operations work seamlessly for aio. * (Note: this routine is intended to be called only * from a kernel thread context) */ void use_mm(struct mm_struct *mm) { struct mm_struct *active_mm; struct task_struct *tsk = current; unsigned long flags; task_lock(tsk); active_mm = tsk->active_mm; ipipe_mm_switch_protect(flags); if (active_mm != mm) { atomic_inc(&mm->mm_count); tsk->active_mm = mm; } tsk->mm = mm; __switch_mm(active_mm, mm, tsk); ipipe_mm_switch_unprotect(flags); task_unlock(tsk); if (active_mm != mm) mmdrop(active_mm); }