函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\futex.c Create Date:2022-07-27 11:53:32
Last Modify:2020-03-17 15:28:32 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:get_futex_key() - Get parameters which are the keys for a futex*@uaddr: virtual address of the futex*@fshared: 0 for a PROCESS_PRIVATE futex, 1 for PROCESS_SHARED*@key: address where result is stored

函数原型:static int get_futex_key(unsigned int __user *uaddr, int fshared, union futex_key *key, enum futex_access rw)

返回类型:int

参数:

类型参数名称
unsigned int __user *uaddr
intfshared
union futex_key *key
enum futex_accessrw
529  address等于uaddr
530  mm等于mm
533  ro等于0
538  offset等于address取模PAGE_SIZE
539  如果此条件成立可能性小(为编译器优化)((address % sizeof(u32)) != 0)则返回:负EINVAL
541  address减等于offset
543  如果此条件成立可能性小(为编译器优化)(!access_ok - Checks if a user space pointer is valid*@addr: User space pointer to start of block to check*@size: Size of block to check* Context: User context only. This function may sleep if pagefaults are* enabled.(uaddr, sizeof(u32)))则返回:负EFAULT
546  如果此条件成立可能性小(为编译器优化)(should_fail_futex(fshared))则返回:负EFAULT
556  如果非fshared
557  mm等于mm
558  address等于address
559  Take a reference to the resource addressed by a key.* Can be called while holding spinlocks.
560  返回:0
563  again :
565  如果此条件成立可能性小(为编译器优化)(should_fail_futex(fshared))则返回:负EFAULT
568  err等于get_user_pages_fast(address, 1, check pte is writable , & page)
573  如果err恒等于负EFAULTrw恒等于FUTEX_READ
574  err等于get_user_pages_fast(address, 1, 0, & page)
575  ro等于1
577  如果err小于0则返回:err
579  否则err等于0
600  tail等于page
601  page等于compound_head(page)
602  mapping等于READ_ONCE( See page-flags.h for PAGE_MAPPING_FLAGS )
619  如果此条件成立可能性小(为编译器优化)(!mapping)则
627  lock_page may only be called if we have the page's inode pinned.
628  shmem_swizzled等于PageSwapCache(page)或 See page-flags.h for PAGE_MAPPING_FLAGS
629  unlock_page(page)
630  put_page(page)
632  如果shmem_swizzled则转到:again
635  返回:负EFAULT
648  如果PageAnon(page)则
654  err等于负EFAULT
655  转到:out
658  offset或等于We set bit 1 if key has a reference on mm
659  mm等于mm
660  address等于address
662  Take a reference to the resource addressed by a key.* Can be called while holding spinlocks.
664  否则
678  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
682  put_page(page)
684  转到:again
687  inode等于READ_ONCE(host)
688  如果非inode
690  put_page(page)
692  转到:again
709  put_page(page)
711  转到:again
715  如果WARN_ON_ONCE(i_mapping != mapping)则
716  err等于负EFAULT
720  转到:out
723  offset或等于We set bit 0 if key has a reference on inode
724  inode等于inode
725  pgoff等于Return page->index in PAGE_SIZE units
726  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
729  out :
730  put_page(page)
731  返回:err
调用者
名称描述
futex_wakeWake up waiters matching bitset queued on this futex (uaddr).
futex_wake_opWake up all waiters hashed on the physical page that is mapped* to this virtual address:
futex_requeueex_requeue() - Requeue waiters from uaddr1 to uaddr2*@uaddr1: source futex user address*@flags: futex flags (FLAGS_SHARED, etc
futex_wait_setupex_wait_setup() - Prepare to wait on a futex*@uaddr: the futex userspace address*@val: the expected value*@flags: futex flags (FLAGS_SHARED, etc.)*@q: the associated futex_q*@hb: storage for hash_bucket pointer to be returned to caller
futex_lock_piUserspace tried a 0 -> TID atomic transition of the futex value* and failed. The kernel side here does the whole locking operation:* if there are waiters then it will block as a consequence of relying* on rt-mutexes, it does PI, etc
futex_unlock_piUserspace attempted a TID -> 0 atomic transition, and failed.* This is the in-kernel slowpath: we look up the PI state (if any),* and do the rt-mutex unlock.
futex_wait_requeue_piex_wait_requeue_pi() - Wait on uaddr and take uaddr2*@uaddr: the futex we initially wait on (non-pi)*@flags: futex flags (FLAGS_SHARED, FLAGS_CLOCKRT, etc