From 16f866b5bc72be0657cafe21b7d8d16fc2909f18 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Fri, 21 May 2010 08:32:31 -0400 Subject: [PATCH] Work queues, tasklets, completions and wait queues. --- 08time/time | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/08time/time b/08time/time index 99c9da9..27a11ef 100644 --- a/08time/time +++ b/08time/time @@ -43,10 +43,72 @@ # 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) -- 2.20.1