Thread (3 messages) 3 messages, 2 authors, 2017-02-13

Sleeping in workqueues

From: Tobias FItschen <hidden>
Date: 2017-02-12 13:45:06

Hello people,

I have a question regarding workqueues. I know it's possible to sleep in 
workqueue routines. Does that mean I can use:

1. "set_current_state(TASK_INTERRUPTIBLE);" get the the task with 
"current" and pass it to a other task and then call "schedule();" in a 
workqueue routine and at a different place (perhaps another workqueue 
routine) use wake_up_process(task)" ?

2. initialize completions in a workqueue routine and call complete() in 
a different workqueue routine?

I tried it in a simple example setup and both worked. I just want to 
make sure that was not just by accident. As I understand it a work item 
is executed on a worker, which is a unique process, but I also know that 
there are exceptions, e.g. I can not copy to or from user space in a 
workqueue routine. Also I don't know if a worker "sticks" with the 
current work item until it is completed or can execute multiple work 
items at the "same" time.

3. In case completions and schedule()/wakeup() work, I would also like 
to know, which has the better performance.

Thanks a lot already!

Tobias
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help