]>
git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blob - mm/mmu_context.c
1 /* Copyright (C) 2009 Red Hat, Inc.
3 * See ../COPYING for licensing terms.
7 #include <linux/sched.h>
8 #include <linux/sched/mm.h>
9 #include <linux/sched/task.h>
10 #include <linux/mmu_context.h>
11 #include <linux/export.h>
13 #include <asm/mmu_context.h>
17 * Makes the calling kernel thread take on the specified
19 * (Note: this routine is intended to be called only
20 * from a kernel thread context)
22 void use_mm(struct mm_struct
*mm
)
24 struct mm_struct
*active_mm
;
25 struct task_struct
*tsk
= current
;
28 /* Hold off tlb flush IPIs while switching mm's */
30 active_mm
= tsk
->active_mm
;
31 if (active_mm
!= mm
) {
36 switch_mm_irqs_off(active_mm
, mm
, tsk
);
39 #ifdef finish_arch_post_lock_switch
40 finish_arch_post_lock_switch();
46 EXPORT_SYMBOL_GPL(use_mm
);
50 * Reverses the effect of use_mm, i.e. releases the
51 * specified mm context which was earlier taken on
52 * by the calling kernel thread
53 * (Note: this routine is intended to be called only
54 * from a kernel thread context)
56 void unuse_mm(struct mm_struct
*mm
)
58 struct task_struct
*tsk
= current
;
64 /* active_mm is still 'mm' */
65 enter_lazy_tlb(mm
, tsk
);
69 EXPORT_SYMBOL_GPL(unuse_mm
);