Lines Matching refs:worker

539 void __init_kthread_worker(struct kthread_worker *worker,  in __init_kthread_worker()  argument
543 spin_lock_init(&worker->lock); in __init_kthread_worker()
544 lockdep_set_class_and_name(&worker->lock, key, name); in __init_kthread_worker()
545 INIT_LIST_HEAD(&worker->work_list); in __init_kthread_worker()
546 worker->task = NULL; in __init_kthread_worker()
567 struct kthread_worker *worker = worker_ptr; in kthread_worker_fn() local
570 WARN_ON(worker->task); in kthread_worker_fn()
571 worker->task = current; in kthread_worker_fn()
577 spin_lock_irq(&worker->lock); in kthread_worker_fn()
578 worker->task = NULL; in kthread_worker_fn()
579 spin_unlock_irq(&worker->lock); in kthread_worker_fn()
584 spin_lock_irq(&worker->lock); in kthread_worker_fn()
585 if (!list_empty(&worker->work_list)) { in kthread_worker_fn()
586 work = list_first_entry(&worker->work_list, in kthread_worker_fn()
590 worker->current_work = work; in kthread_worker_fn()
591 spin_unlock_irq(&worker->lock); in kthread_worker_fn()
605 static void insert_kthread_work(struct kthread_worker *worker, in insert_kthread_work() argument
609 lockdep_assert_held(&worker->lock); in insert_kthread_work()
612 work->worker = worker; in insert_kthread_work()
613 if (!worker->current_work && likely(worker->task)) in insert_kthread_work()
614 wake_up_process(worker->task); in insert_kthread_work()
626 bool queue_kthread_work(struct kthread_worker *worker, in queue_kthread_work() argument
632 spin_lock_irqsave(&worker->lock, flags); in queue_kthread_work()
634 insert_kthread_work(worker, work, &worker->work_list); in queue_kthread_work()
637 spin_unlock_irqrestore(&worker->lock, flags); in queue_kthread_work()
666 struct kthread_worker *worker; in flush_kthread_work() local
670 worker = work->worker; in flush_kthread_work()
671 if (!worker) in flush_kthread_work()
674 spin_lock_irq(&worker->lock); in flush_kthread_work()
675 if (work->worker != worker) { in flush_kthread_work()
676 spin_unlock_irq(&worker->lock); in flush_kthread_work()
681 insert_kthread_work(worker, &fwork.work, work->node.next); in flush_kthread_work()
682 else if (worker->current_work == work) in flush_kthread_work()
683 insert_kthread_work(worker, &fwork.work, worker->work_list.next); in flush_kthread_work()
687 spin_unlock_irq(&worker->lock); in flush_kthread_work()
701 void flush_kthread_worker(struct kthread_worker *worker) in flush_kthread_worker() argument
708 queue_kthread_work(worker, &fwork.work); in flush_kthread_worker()