函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\mmu_notifier.c Create Date:2022-07-27 17:10:41
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Same as mmu_notifier_register but here the caller must hold the mmap_sem in* write mode. A NULL mn signals the notifier is being registered for itree* mode.

函数原型:int __mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm)

返回类型:int

参数:

类型参数名称
struct mmu_notifier *mn
struct mm_struct *mm
569  struct mmu_notifier_mm * mmu_notifier_mm = NULL
572  lockdep_assert_held_write( & mmap_sem)
573  BUG_ON(atomic_read( & *@mm_users: The number of users including userspace. * Use mmget()/mmget_not_zero()/mmput() to modify. When this * drops to 0 (i.e. when the task exits and there are no other * temporary reference holders), we also release a reference on *@mm_count (which ) <= 0)
575  如果IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_LOCKDEP)则
576  fs_reclaim_acquire(GFP_KERNEL)
577  lock_map_acquire( & __mmu_notifier_invalidate_range_start_map)
578  lock_map_release( & __mmu_notifier_invalidate_range_start_map)
579  fs_reclaim_release(GFP_KERNEL)
582  如果非mmu_notifier_mm
588  mmu_notifier_mm等于分配内存并置零
590  如果非mmu_notifier_mm则返回:负ENOMEM
593  INIT_HLIST_HEAD( & all mmu notifiers registered in this mm are queued in this list )
594  spin_lock_init( & serialize the list modifications and hlist_unhashed )
595  invalidate_seq等于2
596  itree =
597  init_waitqueue_head( & wq)
598  INIT_HLIST_HEAD( & deferred_list)
601  ret等于This operation locks against the VM for all pte/vma/mm related* operations that could ever happen on a certain mm. This includes* vmtruncate, try_to_unmap, and all page faults.* The caller must take the mmap_sem in write mode before calling
602  如果此条件成立可能性小(为编译器优化)(ret)则转到:out_clean
620  如果mmu_notifier_mmsmp_store_release( & mmu_notifier_mm, mmu_notifier_mm)
623  如果mn
625  mmgrab() - Pin a &struct mm_struct
626  mm等于mm
627  users等于1
629  加自旋锁
630  添加哈希记录
631  自旋锁解锁
632  否则has_itree = true
635  The mmap_sem cannot be released by the caller until* mm_drop_all_locks() returns.
636  BUG_ON(atomic_read( & *@mm_users: The number of users including userspace. * Use mmget()/mmget_not_zero()/mmput() to modify. When this * drops to 0 (i.e. when the task exits and there are no other * temporary reference holders), we also release a reference on *@mm_count (which ) <= 0)
637  返回:0
639  out_clean :
640  释放内存
641  返回:ret
调用者
名称描述
mmu_notifier_registermmu_notifier_register - Register a notifier on a mm*@mn: The notifier to attach*@mm: The mm to attach the notifier to* Must not hold mmap_sem nor any other VM related lock when calling* this registration function
mmu_notifier_get_lockedmmu_notifier_get_locked - Return the single struct mmu_notifier for* the mm & ops*@ops: The operations struct being subscribe with*@mm : The mm to attach notifiers too* This function either allocates a new mmu_notifier via* list
mmu_interval_notifier_insert_locked