Work queues, tasklets, completions and wait queues.
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Fri, 21 May 2010 12:32:31 +0000 (08:32 -0400)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Fri, 21 May 2010 12:32:31 +0000 (08:32 -0400)
08time/time

index 99c9da9..27a11ef 100644 (file)
 
 # Work queues
 
+* Queues of functions to be called in a kernel thread
+* They execute in process context, so they may sleep
+* However, accessing user space memory does not make sense here
+* Works should not take long or they will delay other works execution
+* There's a default workqueue, keventd or events
+
+# Works
+
+* include linux/workqueue.h
+* struct work\\_struct
+* DECLARE\\_WORK(name, func)
+* INIT\\_WORK(work, func)
+* queue\\_work(wq, work)
+* schedule\\_work(work)
+* flush\\_work(work)
+* cancel\\_work\\_sync(work)
+
 # Delayed work
 
+* struct delayed\\_work
+* DECLARE\\_DELAYED\\_WORK(name, func)
+* INIT\\_DELAYED\\_WORK(dwork, func)
+* queue\\_delayed\\_work(wq, dwork, delay)
+* schedule\\_delayed\\_work(dwork, delay)
+* flush\\_delayed\\_work(dwork)
+* cancel\\_delayed\\_work(dwork)
+* cancel\\_delayed\\_work\\_sync(dwork)
+
+# Workqueue
+
+* create\\_workqueue(name)
+* create\\_singlethread\\_workqueue(name)
+* destroy\\_workqueue(wq)
+* flush\\_workqueue(wq)
+* flush\\_scheduled\\_work()
+
 # Tasklets
 
-# Wait queue
+* include linux/interrupt.h
+* struct tasklet\\_struct
+* DECLARE\\_TASKLET(name, func, data)
+* tasklet\\_init(tsk, func, data)
+* tasklet\\_schedule
+* tasklet\\_hi\\_schedule
+* tasklet\\_enable
+* tasklet\\_disable
+* tasklet\\_kill
 
 # Completion
+
+* include linux/completion.h
+* struct completion
+* DECLARE\\_COMPLETION(name)
+* init\\_completion(comp)
+* wait\\_for\\_completion(comp)
+* wait\\_for\\_completion\\_interruptible
+* wait\\_for\\_completion\\_timeout
+* complete
+
+# Wait queue
+
+* include linux/wait.h
+* wait\\_queue\\_head\\_t
+* DECLARE\\_WAIT\\_QUEUE\\_HEAD(name)
+* init\\_waitqueue\\_head(wqh)
+* wake\\_up(wqh)
+* wait\\_event(wqh, cond)
+* wait\\_event\\_timeout(wqh, cond, timeout)
+* wait\\_event\\_interruptible(wqh, cond)