Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\mmu_notifier.c Create Date:2022-07-28 15:37:16
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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.

Proto:int __mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm)

Type:int

Parameter:

TypeParameterName
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  If IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_LOCKDEP) Then
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  If Not mmu_notifier_mm Then
588  mmu_notifier_mm = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
590  If Not mmu_notifier_mm Then Return -ENOMEM
593  INIT_HLIST_HEAD( & all mmu notifiers registered in this mm are queued in this list )
594  Process spin lock initialization( & 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  If Value for the false possibility is greater at compile time(ret) Then Go to out_clean
620  If mmu_notifier_mm Then smp_store_release( & mmu_notifier_mm, mmu_notifier_mm)
623  If mn Then
625  mmgrab() - Pin a &struct mm_struct
626  mm = mm
627  users = 1
629  spin_lock( & lock)
630  adds the specified element to the specified hlist
631  spin_unlock( & lock)
632  Else 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  Return 0
639  out_clean :
640  kfree(mmu_notifier_mm)
641  Return ret
Caller
NameDescribe
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