Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* 
0003  * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
0004  */
0005 
0006 #ifndef __UM_MMU_CONTEXT_H
0007 #define __UM_MMU_CONTEXT_H
0008 
0009 #include <linux/sched.h>
0010 #include <linux/mm_types.h>
0011 #include <linux/mmap_lock.h>
0012 
0013 #include <asm/mm_hooks.h>
0014 #include <asm/mmu.h>
0015 
0016 extern void force_flush_all(void);
0017 
0018 #define activate_mm activate_mm
0019 static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
0020 {
0021     /*
0022      * This is called by fs/exec.c and sys_unshare()
0023      * when the new ->mm is used for the first time.
0024      */
0025     __switch_mm(&new->context.id);
0026 }
0027 
0028 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 
0029                  struct task_struct *tsk)
0030 {
0031     unsigned cpu = smp_processor_id();
0032 
0033     if(prev != next){
0034         cpumask_clear_cpu(cpu, mm_cpumask(prev));
0035         cpumask_set_cpu(cpu, mm_cpumask(next));
0036         if(next != &init_mm)
0037             __switch_mm(&next->context.id);
0038     }
0039 }
0040 
0041 #define init_new_context init_new_context
0042 extern int init_new_context(struct task_struct *task, struct mm_struct *mm);
0043 
0044 #define destroy_context destroy_context
0045 extern void destroy_context(struct mm_struct *mm);
0046 
0047 #include <asm-generic/mmu_context.h>
0048 
0049 #endif