Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:ex_lock_pi_atomic() - Atomic work required to acquire a pi aware futex*@uaddr: the pi futex user address*@hb: the pi futex hash bucket*@key: the futex key associated with uaddr and hb*@ps: the pi_state pointer where we store the result of the* lookup

Proto:static int futex_lock_pi_atomic(unsigned int __user *uaddr, struct futex_hash_bucket *hb, union futex_key *key, struct futex_pi_state **ps, struct task_struct *task, struct task_struct **exiting, int set_waiters)

Type:int

Parameter:

TypeParameterName
unsigned int __user *uaddr
struct futex_hash_bucket *hb
union futex_key *key
struct futex_pi_state **ps
struct task_struct *task
struct task_struct **exiting
intset_waiters
1428  vpid = task_pid_vnr(task)
1436  If get_futex_value_locked( & uval, uaddr) Then Return -EFAULT
1439  If Value for the false possibility is greater at compile time(should_fail_futex(true)) Then Return -EFAULT
1445  If Value for the false possibility is greater at compile time((uval & The rest of the robust-futex field is for the TID:) == vpid) Then Return -EDEADLK
1448  If Value for the false possibility is greater at compile time(should_fail_futex(true)) Then Return -EDEADLK
1455  top_waiter = ex_top_waiter() - Return the highest priority waiter on a futex*@hb: the hash bucket the futex_q's reside in*@key: the futex key (to distinguish it from other futex futex_q's)* Must be called with the hb lock held.
1456  If top_waiter Then Return Validate that the existing waiter has a pi_state and sanity check* the pi_state against the user space value. If correct, attach to* it.
1465  If Not (uval & The rest of the robust-futex field is for the TID:) Then
1470  newval = uval & The kernel signals via this bit that a thread holding a futex* has exited without unlocking the futex. The kernel also does* a FUTEX_WAKE on such futexes, after setting the bit, to wake* up any possible waiters:
1471  newval |= vpid
1474  If set_waiters Then newval |= Are there any waiters for this robust futex:
1477  ret = lock_pi_update_atomic(uaddr, uval, newval)
1479  Return If ret < 0 Then ret Else 1
1487  newval = uval | Are there any waiters for this robust futex:
1488  ret = lock_pi_update_atomic(uaddr, uval, newval)
1489  If ret Then Return ret
1496  Return Lookup the task for the TID provided from user space and attach to* it after doing proper sanity checks.
Caller
NameDescribe
futex_proxy_trylock_atomicex_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
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