Lines Matching refs:work
627 struct kthread_work *work; in kthread_worker_fn() local
650 work = NULL; in kthread_worker_fn()
653 work = list_first_entry(&worker->work_list, in kthread_worker_fn()
655 list_del_init(&work->node); in kthread_worker_fn()
657 worker->current_work = work; in kthread_worker_fn()
660 if (work) { in kthread_worker_fn()
662 work->func(work); in kthread_worker_fn()
768 struct kthread_work *work) in queuing_blocked() argument
772 return !list_empty(&work->node) || work->canceling; in queuing_blocked()
776 struct kthread_work *work) in kthread_insert_work_sanity_check() argument
779 WARN_ON_ONCE(!list_empty(&work->node)); in kthread_insert_work_sanity_check()
781 WARN_ON_ONCE(work->worker && work->worker != worker); in kthread_insert_work_sanity_check()
786 struct kthread_work *work, in kthread_insert_work() argument
789 kthread_insert_work_sanity_check(worker, work); in kthread_insert_work()
791 list_add_tail(&work->node, pos); in kthread_insert_work()
792 work->worker = worker; in kthread_insert_work()
810 struct kthread_work *work) in kthread_queue_work() argument
816 if (!queuing_blocked(worker, work)) { in kthread_queue_work()
817 kthread_insert_work(worker, work, &worker->work_list); in kthread_queue_work()
836 struct kthread_work *work = &dwork->work; in kthread_delayed_work_timer_fn() local
837 struct kthread_worker *worker = work->worker; in kthread_delayed_work_timer_fn()
848 WARN_ON_ONCE(work->worker != worker); in kthread_delayed_work_timer_fn()
851 WARN_ON_ONCE(list_empty(&work->node)); in kthread_delayed_work_timer_fn()
852 list_del_init(&work->node); in kthread_delayed_work_timer_fn()
853 kthread_insert_work(worker, work, &worker->work_list); in kthread_delayed_work_timer_fn()
864 struct kthread_work *work = &dwork->work; in __kthread_queue_delayed_work() local
875 kthread_insert_work(worker, work, &worker->work_list); in __kthread_queue_delayed_work()
880 kthread_insert_work_sanity_check(worker, work); in __kthread_queue_delayed_work()
882 list_add(&work->node, &worker->delayed_work_list); in __kthread_queue_delayed_work()
883 work->worker = worker; in __kthread_queue_delayed_work()
907 struct kthread_work *work = &dwork->work; in kthread_queue_delayed_work() local
913 if (!queuing_blocked(worker, work)) { in kthread_queue_delayed_work()
924 struct kthread_work work; member
928 static void kthread_flush_work_fn(struct kthread_work *work) in kthread_flush_work_fn() argument
931 container_of(work, struct kthread_flush_work, work); in kthread_flush_work_fn()
941 void kthread_flush_work(struct kthread_work *work) in kthread_flush_work() argument
944 KTHREAD_WORK_INIT(fwork.work, kthread_flush_work_fn), in kthread_flush_work()
950 worker = work->worker; in kthread_flush_work()
956 WARN_ON_ONCE(work->worker != worker); in kthread_flush_work()
958 if (!list_empty(&work->node)) in kthread_flush_work()
959 kthread_insert_work(worker, &fwork.work, work->node.next); in kthread_flush_work()
960 else if (worker->current_work == work) in kthread_flush_work()
961 kthread_insert_work(worker, &fwork.work, in kthread_flush_work()
983 static bool __kthread_cancel_work(struct kthread_work *work, bool is_dwork, in __kthread_cancel_work() argument
989 container_of(work, struct kthread_delayed_work, work); in __kthread_cancel_work()
990 struct kthread_worker *worker = work->worker; in __kthread_cancel_work()
998 work->canceling++; in __kthread_cancel_work()
1002 work->canceling--; in __kthread_cancel_work()
1009 if (!list_empty(&work->node)) { in __kthread_cancel_work()
1010 list_del_init(&work->node); in __kthread_cancel_work()
1044 struct kthread_work *work = &dwork->work; in kthread_mod_delayed_work() local
1051 if (!work->worker) in kthread_mod_delayed_work()
1055 WARN_ON_ONCE(work->worker != worker); in kthread_mod_delayed_work()
1058 if (work->canceling) in kthread_mod_delayed_work()
1061 ret = __kthread_cancel_work(work, true, &flags); in kthread_mod_delayed_work()
1070 static bool __kthread_cancel_work_sync(struct kthread_work *work, bool is_dwork) in __kthread_cancel_work_sync() argument
1072 struct kthread_worker *worker = work->worker; in __kthread_cancel_work_sync()
1081 WARN_ON_ONCE(work->worker != worker); in __kthread_cancel_work_sync()
1083 ret = __kthread_cancel_work(work, is_dwork, &flags); in __kthread_cancel_work_sync()
1085 if (worker->current_work != work) in __kthread_cancel_work_sync()
1092 work->canceling++; in __kthread_cancel_work_sync()
1094 kthread_flush_work(work); in __kthread_cancel_work_sync()
1096 work->canceling--; in __kthread_cancel_work_sync()
1120 bool kthread_cancel_work_sync(struct kthread_work *work) in kthread_cancel_work_sync() argument
1122 return __kthread_cancel_work_sync(work, false); in kthread_cancel_work_sync()
1137 return __kthread_cancel_work_sync(&dwork->work, true); in kthread_cancel_delayed_work_sync()
1151 KTHREAD_WORK_INIT(fwork.work, kthread_flush_work_fn), in kthread_flush_worker()
1155 kthread_queue_work(worker, &fwork.work); in kthread_flush_worker()