     ,     
    . ,    -
   ,   , 
 .      ,   -
  ,     .   
     work_struct  . 
  ,     .

      worker_thread ().

for (;;) ( .

set_task_state(current, TASK_INTERRUPTIBLE) ;

add wait queue(&cwq->more_work, swait);

if (list_empty(&cwq->worklist))

schedule() ;

else

set_task_state(current, TASK_RUNNING) ;

remove wait_queue(&cwq->more_work, Swait);

if (!list_empty(&cwq->worklist))

run workqueue(cwq);

)

       .

       (  -
   TASK_INTERRUPTIBLE),      
.

     ,     schedule ()
    .

    ,       .  -
       TASK_RUNNING   
  .

    ,    run_workqueue ()  -
  .

 run_workqueue ()

 run_workqueue ()       -
,   .

while ('list empty (,&cwq->worklist) ).{
struct work_struct *work;

void (*f)(void *) ;

void *data;

work = list entry(cwq->worklist.next, struct work struct, entry);

f = work->func;

data = work->data;

list del init(cwq->worklist.next);

clear_bit(0, &work->pending);

f(data) ;

152  7