mmu_context.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_GENERIC_MMU_CONTEXT_H
  3. #define __ASM_GENERIC_MMU_CONTEXT_H
  4. /*
  5. * Generic hooks to implement no-op functionality.
  6. */
  7. struct task_struct;
  8. struct mm_struct;
  9. /*
  10. * enter_lazy_tlb - Called when "tsk" is about to enter lazy TLB mode.
  11. *
  12. * @mm: the currently active mm context which is becoming lazy
  13. * @tsk: task which is entering lazy tlb
  14. *
  15. * tsk->mm will be NULL
  16. */
  17. #ifndef enter_lazy_tlb
  18. static inline void enter_lazy_tlb(struct mm_struct *mm,
  19. struct task_struct *tsk)
  20. {
  21. }
  22. #endif
  23. /**
  24. * init_new_context - Initialize context of a new mm_struct.
  25. * @tsk: task struct for the mm
  26. * @mm: the new mm struct
  27. * @return: 0 on success, -errno on failure
  28. */
  29. #ifndef init_new_context
  30. static inline int init_new_context(struct task_struct *tsk,
  31. struct mm_struct *mm)
  32. {
  33. return 0;
  34. }
  35. #endif
  36. /**
  37. * destroy_context - Undo init_new_context when the mm is going away
  38. * @mm: old mm struct
  39. */
  40. #ifndef destroy_context
  41. static inline void destroy_context(struct mm_struct *mm)
  42. {
  43. }
  44. #endif
  45. /**
  46. * activate_mm - called after exec switches the current task to a new mm, to switch to it
  47. * @prev_mm: previous mm of this task
  48. * @next_mm: new mm
  49. */
  50. #ifndef activate_mm
  51. static inline void activate_mm(struct mm_struct *prev_mm,
  52. struct mm_struct *next_mm)
  53. {
  54. switch_mm(prev_mm, next_mm, current);
  55. }
  56. #endif
  57. /**
  58. * dectivate_mm - called when an mm is released after exit or exec switches away from it
  59. * @tsk: the task
  60. * @mm: the old mm
  61. */
  62. #ifndef deactivate_mm
  63. static inline void deactivate_mm(struct task_struct *tsk,
  64. struct mm_struct *mm)
  65. {
  66. }
  67. #endif
  68. #endif /* __ASM_GENERIC_MMU_CONTEXT_H */