Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\futex.c Create Date:2022-07-28 10:54:16
Last Modify:2020-03-17 15:28:32 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:ex_requeue() - Requeue waiters from uaddr1 to uaddr2*@uaddr1: source futex user address*@flags: futex flags (FLAGS_SHARED, etc

Proto:static int futex_requeue(unsigned int __user *uaddr1, unsigned int flags, unsigned int __user *uaddr2, int nr_wake, int nr_requeue, unsigned int *cmpval, int requeue_pi)

Type:int

Parameter:

TypeParameterName
unsigned int __user *uaddr1
unsigned intflags
unsigned int __user *uaddr2
intnr_wake
intnr_requeue
unsigned int *cmpval
intrequeue_pi
2003  key1 = FUTEX_KEY_INIT , key2 = FUTEX_KEY_INIT
2004  drop_count = 0 , task_count = 0
2005  struct futex_pi_state * pi_state = NULL
2010  If nr_wake < 0 || nr_requeue < 0 Then Return -EINVAL
2019  If Not IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_FUTEX_PI) && requeue_pi Then Return -ENOSYS
2022  If requeue_pi Then
2027  If uaddr1 == uaddr2 Then Return -EINVAL
2034  If PI code: Then Return -ENOMEM
2046  If nr_wake != 1 Then Return -EINVAL
2050  retry :
2051  ret = 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
2052  If Value for the false possibility is greater at compile time(ret != 0) Then Go to out
2054  ret = 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
2056  If Value for the false possibility is greater at compile time(ret != 0) Then Go to out_put_key1
2063  If requeue_pi && match_futex - Check whether two futex keys are equal*@key1: Pointer to key1*@key2: Pointer to key2* Return 1 if two futex_keys are equal, 0 otherwise. Then
2064  ret = -EINVAL
2065  Go to out_put_keys
2068  hb1 = hash_futex - Return the hash bucket in the global hash*@key: Pointer to the futex key for which the hash is calculated* We hash on the keys returned from get_futex_key (see below) and return the* corresponding hash bucket in the global hash.
2069  hb2 = hash_futex - Return the hash bucket in the global hash*@key: Pointer to the futex key for which the hash is calculated* We hash on the keys returned from get_futex_key (see below) and return the* corresponding hash bucket in the global hash.
2071  retry_private :
2072  Reflects a new waiter being added to the waitqueue.
2073  Express the locking dependencies for lockdep:
2075  If Value is more likely to compile time(cmpval != NULL) Then
2078  ret = get_futex_value_locked( & curval, uaddr1)
2085  If ret Then Go to out_put_keys
2091  put_futex_key( & key2)
2092  put_futex_key( & key1)
2093  Go to retry
2095  If curval != cmpval Then
2096  ret = -EAGAIN
2097  Go to out_unlock
2101  If requeue_pi && task_count - nr_wake < nr_requeue Then
2102  struct task_struct * exiting = NULL
2110  ret = ex_proxy_trylock_atomic() - Attempt an atomic lock for the top waiter*@pifutex: the user address of the to futex*@hb1: the from futex hash bucket, must be locked by the caller*@hb2: the to futex hash bucket, must be locked by the caller*@key1: the from
2123  If ret > 0 Then
2124  WARN_ON(pi_state)
2125  drop_count++
2126  task_count++
2144  Case ret == 0
2146  Break
2149  Case ret == -EFAULT
2158  Case ret == -EBUSY
2159  Case ret == -EAGAIN
2178  Default
2179  Go to out_unlock
2184  If task_count - nr_wake >= nr_requeue Then Break
2197  If requeue_pi && Not rt_waiter || Not requeue_pi && rt_waiter || pi_state Then
2200  ret = -EINVAL
2201  Break
2209  If ++task_count <= nr_wake && Not requeue_pi Then
2216  ret = -EINVAL
2217  Break
2224  If requeue_pi Then
2266  drop_count++
2274  Drops a reference to the pi_state object and frees or caches it* when the last reference is gone.
2276  out_unlock :
2277  double_unlock_hb(hb1, hb2)
2278  wake_up_q( & wake_q)
2279  Reflects a waiter being removed from the waitqueue by wakeup* paths.
2287  When --drop_count >= 0 cycle
2288  Drop a reference to the resource addressed by a key.* The hash bucket spinlock must not be held. This is* a no-op for private futexes, see comment in the get* counterpart.
2290  out_put_keys :
2291  put_futex_key( & key2)
2292  out_put_key1 :
2293  put_futex_key( & key1)
2294  out :
2295  Return If ret Then ret Else task_count
Caller
NameDescribe
do_futex