Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\eventpoll.c Create Date:2022-07-28 20:19:07
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:This is the callback that is passed to the wait queue wakeup* mechanism

Proto:static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, void *key)

Type:int

Parameter:

TypeParameterName
wait_queue_entry_t *wait
unsignedmode
intsync
void *key
1188  pwake = 0
1189  epi = Get the "struct epitem" from a wait queue pointer
1190  ep = The "container" of this item
1191  pollflags = key_to_poll(key)
1193  ewake = 0
1195  read_lock_irqsave( & Lock which protects rdllist and ovflist , flags)
1197  ep_set_busy_poll_napi_id(epi)
1205  If Not (events & ~Epoll private bits inside the event mask ) Then Go to out_unlock
1214  If pollflags && Not (pollflags & events) Then Go to out_unlock
1223  If READ_ONCE(* This is a single linked list that chains all the "struct epitem" that * happened while transferring ready events to userspace w/out * holding ->lock.) != EP_UNACTIVE_PTR Then
1224  If Works together "struct eventpoll"->ovflist in keeping the* single linked chain of items. == EP_UNACTIVE_PTR && Chains a new epi entry to the tail of the ep->ovflist in a lockless way,* i.e. multiple CPUs are allowed to call this function concurrently.* Returns %false if epi element has been already chained, %true otherwise. Then all when ep->mtx cannot be held (ep_poll_callback)
1227  Go to out_unlock
1231  If Not Tells us if the item is currently linked && Adds a new entry to the tail of the list in a lockless way, i Then
1233  all when ep->mtx cannot be held (ep_poll_callback)
1240  If waitqueue_active -- locklessly test for waiters on the queue*@wq_head: the waitqueue to test for waiters* returns true if the wait list is not empty* NOTE: this function is lockless and requires care, incorrect usage _will_ Then
1244  Case & == Epoll event masks
1245  If events & Epoll event masks Then ewake = 1
1247  Break
1248  Case & == EPOLLOUT
1249  If events & EPOLLOUT Then ewake = 1
1251  Break
1252  Case & == 0
1253  ewake = 1
1254  Break
1257  wake_up( & Wait queue used by sys_epoll_wait() )
1259  If waitqueue_active -- locklessly test for waiters on the queue*@wq_head: the waitqueue to test for waiters* returns true if the wait list is not empty* NOTE: this function is lockless and requires care, incorrect usage _will_ Then pwake++
1262  out_unlock :
1263  read_unlock_irqrestore( & Lock which protects rdllist and ovflist , flags)
1266  If pwake Then ep_poll_safewake( & Wait queue used by file->poll() )
1269  If Not (events & Set exclusive wakeup mode for the target file descriptor ) Then ewake = 1
1272  If pollflags & POLLFREE Then
1278  list_del_init - deletes entry from list and reinitialize it.*@entry: the element to delete from the list.
1285  smp_store_release( & The wait queue head that linked the "wait" wait queue item , NULL)
1288  Return ewake