Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_GENERIC_MMU_CONTEXT_H
0003 #define __ASM_GENERIC_MMU_CONTEXT_H
0004 
0005 /*
0006  * Generic hooks to implement no-op functionality.
0007  */
0008 
0009 struct task_struct;
0010 struct mm_struct;
0011 
0012 /*
0013  * enter_lazy_tlb - Called when "tsk" is about to enter lazy TLB mode.
0014  *
0015  * @mm:  the currently active mm context which is becoming lazy
0016  * @tsk: task which is entering lazy tlb
0017  *
0018  * tsk->mm will be NULL
0019  */
0020 #ifndef enter_lazy_tlb
0021 static inline void enter_lazy_tlb(struct mm_struct *mm,
0022             struct task_struct *tsk)
0023 {
0024 }
0025 #endif
0026 
0027 /**
0028  * init_new_context - Initialize context of a new mm_struct.
0029  * @tsk: task struct for the mm
0030  * @mm:  the new mm struct
0031  * @return: 0 on success, -errno on failure
0032  */
0033 #ifndef init_new_context
0034 static inline int init_new_context(struct task_struct *tsk,
0035             struct mm_struct *mm)
0036 {
0037     return 0;
0038 }
0039 #endif
0040 
0041 /**
0042  * destroy_context - Undo init_new_context when the mm is going away
0043  * @mm: old mm struct
0044  */
0045 #ifndef destroy_context
0046 static inline void destroy_context(struct mm_struct *mm)
0047 {
0048 }
0049 #endif
0050 
0051 /**
0052  * activate_mm - called after exec switches the current task to a new mm, to switch to it
0053  * @prev_mm: previous mm of this task
0054  * @next_mm: new mm
0055  */
0056 #ifndef activate_mm
0057 static inline void activate_mm(struct mm_struct *prev_mm,
0058                    struct mm_struct *next_mm)
0059 {
0060     switch_mm(prev_mm, next_mm, current);
0061 }
0062 #endif
0063 
0064 /**
0065  * dectivate_mm - called when an mm is released after exit or exec switches away from it
0066  * @tsk: the task
0067  * @mm:  the old mm
0068  */
0069 #ifndef deactivate_mm
0070 static inline void deactivate_mm(struct task_struct *tsk,
0071             struct mm_struct *mm)
0072 {
0073 }
0074 #endif
0075 
0076 #endif /* __ASM_GENERIC_MMU_CONTEXT_H */