Lines Matching refs:work
973 struct kthread_work *work; in kthread_worker_fn() local
996 work = NULL; in kthread_worker_fn()
999 work = list_first_entry(&worker->work_list, in kthread_worker_fn()
1001 list_del_init(&work->node); in kthread_worker_fn()
1003 worker->current_work = work; in kthread_worker_fn()
1006 if (work) { in kthread_worker_fn()
1007 kthread_work_func_t func = work->func; in kthread_worker_fn()
1009 trace_sched_kthread_work_execute_start(work); in kthread_worker_fn()
1010 work->func(work); in kthread_worker_fn()
1015 trace_sched_kthread_work_execute_end(work, func); in kthread_worker_fn()
1141 struct kthread_work *work) in queuing_blocked() argument
1145 return !list_empty(&work->node) || work->canceling; in queuing_blocked()
1149 struct kthread_work *work) in kthread_insert_work_sanity_check() argument
1152 WARN_ON_ONCE(!list_empty(&work->node)); in kthread_insert_work_sanity_check()
1154 WARN_ON_ONCE(work->worker && work->worker != worker); in kthread_insert_work_sanity_check()
1159 struct kthread_work *work, in kthread_insert_work() argument
1162 kthread_insert_work_sanity_check(worker, work); in kthread_insert_work()
1164 trace_sched_kthread_work_queue_work(worker, work); in kthread_insert_work()
1166 list_add_tail(&work->node, pos); in kthread_insert_work()
1167 work->worker = worker; in kthread_insert_work()
1185 struct kthread_work *work) in kthread_queue_work() argument
1191 if (!queuing_blocked(worker, work)) { in kthread_queue_work()
1192 kthread_insert_work(worker, work, &worker->work_list); in kthread_queue_work()
1212 struct kthread_work *work = &dwork->work; in kthread_delayed_work_timer_fn() local
1213 struct kthread_worker *worker = work->worker; in kthread_delayed_work_timer_fn()
1225 WARN_ON_ONCE(work->worker != worker); in kthread_delayed_work_timer_fn()
1228 WARN_ON_ONCE(list_empty(&work->node)); in kthread_delayed_work_timer_fn()
1229 list_del_init(&work->node); in kthread_delayed_work_timer_fn()
1230 if (!work->canceling) in kthread_delayed_work_timer_fn()
1231 kthread_insert_work(worker, work, &worker->work_list); in kthread_delayed_work_timer_fn()
1242 struct kthread_work *work = &dwork->work; in __kthread_queue_delayed_work() local
1253 kthread_insert_work(worker, work, &worker->work_list); in __kthread_queue_delayed_work()
1258 kthread_insert_work_sanity_check(worker, work); in __kthread_queue_delayed_work()
1260 list_add(&work->node, &worker->delayed_work_list); in __kthread_queue_delayed_work()
1261 work->worker = worker; in __kthread_queue_delayed_work()
1285 struct kthread_work *work = &dwork->work; in kthread_queue_delayed_work() local
1291 if (!queuing_blocked(worker, work)) { in kthread_queue_delayed_work()
1302 struct kthread_work work; member
1306 static void kthread_flush_work_fn(struct kthread_work *work) in kthread_flush_work_fn() argument
1309 container_of(work, struct kthread_flush_work, work); in kthread_flush_work_fn()
1319 void kthread_flush_work(struct kthread_work *work) in kthread_flush_work() argument
1322 KTHREAD_WORK_INIT(fwork.work, kthread_flush_work_fn), in kthread_flush_work()
1328 worker = work->worker; in kthread_flush_work()
1334 WARN_ON_ONCE(work->worker != worker); in kthread_flush_work()
1336 if (!list_empty(&work->node)) in kthread_flush_work()
1337 kthread_insert_work(worker, &fwork.work, work->node.next); in kthread_flush_work()
1338 else if (worker->current_work == work) in kthread_flush_work()
1339 kthread_insert_work(worker, &fwork.work, in kthread_flush_work()
1358 static void kthread_cancel_delayed_work_timer(struct kthread_work *work, in kthread_cancel_delayed_work_timer() argument
1362 container_of(work, struct kthread_delayed_work, work); in kthread_cancel_delayed_work_timer()
1363 struct kthread_worker *worker = work->worker; in kthread_cancel_delayed_work_timer()
1371 work->canceling++; in kthread_cancel_delayed_work_timer()
1375 work->canceling--; in kthread_cancel_delayed_work_timer()
1391 static bool __kthread_cancel_work(struct kthread_work *work) in __kthread_cancel_work() argument
1397 if (!list_empty(&work->node)) { in __kthread_cancel_work()
1398 list_del_init(&work->node); in __kthread_cancel_work()
1432 struct kthread_work *work = &dwork->work; in kthread_mod_delayed_work() local
1439 if (!work->worker) { in kthread_mod_delayed_work()
1445 WARN_ON_ONCE(work->worker != worker); in kthread_mod_delayed_work()
1459 kthread_cancel_delayed_work_timer(work, &flags); in kthread_mod_delayed_work()
1460 if (work->canceling) { in kthread_mod_delayed_work()
1465 ret = __kthread_cancel_work(work); in kthread_mod_delayed_work()
1475 static bool __kthread_cancel_work_sync(struct kthread_work *work, bool is_dwork) in __kthread_cancel_work_sync() argument
1477 struct kthread_worker *worker = work->worker; in __kthread_cancel_work_sync()
1486 WARN_ON_ONCE(work->worker != worker); in __kthread_cancel_work_sync()
1489 kthread_cancel_delayed_work_timer(work, &flags); in __kthread_cancel_work_sync()
1491 ret = __kthread_cancel_work(work); in __kthread_cancel_work_sync()
1493 if (worker->current_work != work) in __kthread_cancel_work_sync()
1500 work->canceling++; in __kthread_cancel_work_sync()
1502 kthread_flush_work(work); in __kthread_cancel_work_sync()
1504 work->canceling--; in __kthread_cancel_work_sync()
1528 bool kthread_cancel_work_sync(struct kthread_work *work) in kthread_cancel_work_sync() argument
1530 return __kthread_cancel_work_sync(work, false); in kthread_cancel_work_sync()
1545 return __kthread_cancel_work_sync(&dwork->work, true); in kthread_cancel_delayed_work_sync()
1559 KTHREAD_WORK_INIT(fwork.work, kthread_flush_work_fn), in kthread_flush_worker()
1563 kthread_queue_work(worker, &fwork.work); in kthread_flush_worker()