• Home
  • Raw
  • Download

Lines Matching full:work

18  * This is the generic async execution mechanism.  Work items as are
21 * normal work items and the other for high priority ones) and some extra
236 * The externally visible workqueue. It relays the issued work items to
244 int work_color; /* WQ: current work color */
311 /* PL: allowable cpus for unbound wqs and work items */
314 /* CPU where unbound work was last round robin scheduled from this CPU */
318 * Local execution of unbound work items is no longer guaranteed. The
319 * following always forces round-robin CPU selection on unbound work items
440 struct work_struct *work = addr; in work_is_static_object() local
442 return test_bit(WORK_STRUCT_STATIC_BIT, work_data_bits(work)); in work_is_static_object()
451 struct work_struct *work = addr; in work_fixup_init() local
455 cancel_work_sync(work); in work_fixup_init()
456 debug_object_init(work, &work_debug_descr); in work_fixup_init()
469 struct work_struct *work = addr; in work_fixup_free() local
473 cancel_work_sync(work); in work_fixup_free()
474 debug_object_free(work, &work_debug_descr); in work_fixup_free()
489 static inline void debug_work_activate(struct work_struct *work) in debug_work_activate() argument
491 debug_object_activate(work, &work_debug_descr); in debug_work_activate()
494 static inline void debug_work_deactivate(struct work_struct *work) in debug_work_deactivate() argument
496 debug_object_deactivate(work, &work_debug_descr); in debug_work_deactivate()
499 void __init_work(struct work_struct *work, int onstack) in __init_work() argument
502 debug_object_init_on_stack(work, &work_debug_descr); in __init_work()
504 debug_object_init(work, &work_debug_descr); in __init_work()
508 void destroy_work_on_stack(struct work_struct *work) in destroy_work_on_stack() argument
510 debug_object_free(work, &work_debug_descr); in destroy_work_on_stack()
514 void destroy_delayed_work_on_stack(struct delayed_work *work) in destroy_delayed_work_on_stack() argument
516 destroy_timer_on_stack(&work->timer); in destroy_delayed_work_on_stack()
517 debug_object_free(&work->work, &work_debug_descr); in destroy_delayed_work_on_stack()
522 static inline void debug_work_activate(struct work_struct *work) { } in debug_work_activate() argument
523 static inline void debug_work_deactivate(struct work_struct *work) { } in debug_work_deactivate() argument
582 static int get_work_color(struct work_struct *work) in get_work_color() argument
584 return (*work_data_bits(work) >> WORK_STRUCT_COLOR_SHIFT) & in get_work_color()
594 * While queued, %WORK_STRUCT_PWQ is set and non flag bits of a work's data
600 * work->data. These functions should only be called while the work is
604 * corresponding to a work. Pool is available once the work has been
606 * available only while the work item is queued.
608 * %WORK_OFFQ_CANCELING is used to mark a work item which is being
609 * canceled. While being canceled, a work item may have its PENDING set
613 static inline void set_work_data(struct work_struct *work, unsigned long data, in set_work_data() argument
616 WARN_ON_ONCE(!work_pending(work)); in set_work_data()
617 atomic_long_set(&work->data, data | flags | work_static(work)); in set_work_data()
620 static void set_work_pwq(struct work_struct *work, struct pool_workqueue *pwq, in set_work_pwq() argument
623 set_work_data(work, (unsigned long)pwq, in set_work_pwq()
627 static void set_work_pool_and_keep_pending(struct work_struct *work, in set_work_pool_and_keep_pending() argument
630 set_work_data(work, (unsigned long)pool_id << WORK_OFFQ_POOL_SHIFT, in set_work_pool_and_keep_pending()
634 static void set_work_pool_and_clear_pending(struct work_struct *work, in set_work_pool_and_clear_pending() argument
639 * test_and_set_bit(PENDING) and ensures all updates to @work made in set_work_pool_and_clear_pending()
644 set_work_data(work, (unsigned long)pool_id << WORK_OFFQ_POOL_SHIFT, 0); in set_work_pool_and_clear_pending()
648 * work->current_func, which is executed afterwards. This possible in set_work_pool_and_clear_pending()
650 * the same @work. E.g. consider this case: in set_work_pool_and_clear_pending()
661 * 7 work->current_func() { in set_work_pool_and_clear_pending()
668 * a @work is not queued in a hope, that CPU#1 will eventually in set_work_pool_and_clear_pending()
669 * finish the queued @work. Meanwhile CPU#1 does not see in set_work_pool_and_clear_pending()
676 static void clear_work_data(struct work_struct *work) in clear_work_data() argument
679 set_work_data(work, WORK_STRUCT_NO_POOL, 0); in clear_work_data()
682 static struct pool_workqueue *get_work_pwq(struct work_struct *work) in get_work_pwq() argument
684 unsigned long data = atomic_long_read(&work->data); in get_work_pwq()
693 * get_work_pool - return the worker_pool a given work was associated with
694 * @work: the work item of interest
705 * Return: The worker_pool @work was last associated with. %NULL if none.
707 static struct worker_pool *get_work_pool(struct work_struct *work) in get_work_pool() argument
709 unsigned long data = atomic_long_read(&work->data); in get_work_pool()
726 * get_work_pool_id - return the worker pool ID a given work is associated with
727 * @work: the work item of interest
729 * Return: The worker_pool ID @work was last associated with.
732 static int get_work_pool_id(struct work_struct *work) in get_work_pool_id() argument
734 unsigned long data = atomic_long_read(&work->data); in get_work_pool_id()
743 static void mark_work_canceling(struct work_struct *work) in mark_work_canceling() argument
745 unsigned long pool_id = get_work_pool_id(work); in mark_work_canceling()
748 set_work_data(work, pool_id | WORK_OFFQ_CANCELING, WORK_STRUCT_PENDING); in mark_work_canceling()
751 static bool work_is_canceling(struct work_struct *work) in work_is_canceling() argument
753 unsigned long data = atomic_long_read(&work->data); in work_is_canceling()
918 * wq_worker_last_func - retrieve worker's last work function
919 * @task: Task to retrieve last work function of.
938 * The last work function %current executed as a worker, NULL if it
939 * hasn't executed any work yet.
1003 * find_worker_executing_work - find worker which is executing a work
1005 * @work: work to find worker for
1007 * Find a worker which is executing @work on @pool by searching
1008 * @pool->busy_hash which is keyed by the address of @work. For a worker
1009 * to match, its current execution should match the address of @work and
1010 * its work function. This is to avoid unwanted dependency between
1011 * unrelated work executions through a work item being recycled while still
1014 * This is a bit tricky. A work item may be freed once its execution
1016 * another work item. If the same work item address ends up being reused
1018 * recycled work item as currently executing and make it wait until the
1021 * This function checks the work item address and work function to avoid
1023 * work function which can introduce dependency onto itself through a
1024 * recycled work item. Well, if somebody wants to shoot oneself in the
1026 * actually occurs, it should be easy to locate the culprit work function.
1032 * Pointer to worker which is executing @work if found, %NULL
1036 struct work_struct *work) in find_worker_executing_work() argument
1041 (unsigned long)work) in find_worker_executing_work()
1042 if (worker->current_work == work && in find_worker_executing_work()
1043 worker->current_func == work->func) in find_worker_executing_work()
1051 * @work: start of series of works to be scheduled
1052 * @head: target list to append @work to
1055 * Schedule linked works starting from @work to @head. Work series to
1056 * be scheduled starts at @work and includes any consecutive work with
1059 * If @nextp is not NULL, it's updated to point to the next work of
1060 * the last scheduled work. This allows move_linked_works() to be
1066 static void move_linked_works(struct work_struct *work, struct list_head *head, in move_linked_works() argument
1075 list_for_each_entry_safe_from(work, n, NULL, entry) { in move_linked_works()
1076 list_move_tail(&work->entry, head); in move_linked_works()
1077 if (!(*work_data_bits(work) & WORK_STRUCT_LINKED)) in move_linked_works()
1122 * the release work item is scheduled on a per-cpu workqueue. To in put_pwq()
1148 static void pwq_activate_delayed_work(struct work_struct *work) in pwq_activate_delayed_work() argument
1150 struct pool_workqueue *pwq = get_work_pwq(work); in pwq_activate_delayed_work()
1152 trace_workqueue_activate_work(work); in pwq_activate_delayed_work()
1155 move_linked_works(work, &pwq->pool->worklist, NULL); in pwq_activate_delayed_work()
1156 __clear_bit(WORK_STRUCT_DELAYED_BIT, work_data_bits(work)); in pwq_activate_delayed_work()
1162 struct work_struct *work = list_first_entry(&pwq->delayed_works, in pwq_activate_first_delayed() local
1165 pwq_activate_delayed_work(work); in pwq_activate_first_delayed()
1171 * @color: color of work which left the queue
1173 * A work either has completed or is removed from pending queue,
1181 /* uncolored work items don't participate in flushing or nr_active */ in pwq_dec_nr_in_flight()
1216 * try_to_grab_pending - steal work item from worklist and disable irq
1217 * @work: work item to steal
1218 * @is_dwork: @work is a delayed_work
1221 * Try to grab PENDING bit of @work. This function can handle @work in any
1227 * 1 if @work was pending and we successfully stole PENDING
1228 * 0 if @work was idle and we claimed PENDING
1230 * -ENOENT if someone else is canceling @work, this state may persist
1235 * On >= 0 return, the caller owns @work's PENDING bit. To avoid getting
1236 * interrupted while holding PENDING and @work off queue, irq must be
1245 static int try_to_grab_pending(struct work_struct *work, bool is_dwork, in try_to_grab_pending() argument
1255 struct delayed_work *dwork = to_delayed_work(work); in try_to_grab_pending()
1267 if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) in try_to_grab_pending()
1275 pool = get_work_pool(work); in try_to_grab_pending()
1281 * work->data is guaranteed to point to pwq only while the work in try_to_grab_pending()
1282 * item is queued on pwq->wq, and both updating work->data to point in try_to_grab_pending()
1284 * pwq->pool->lock. This in turn guarantees that, if work->data in try_to_grab_pending()
1285 * points to pwq which is associated with a locked pool, the work in try_to_grab_pending()
1288 pwq = get_work_pwq(work); in try_to_grab_pending()
1290 debug_work_deactivate(work); in try_to_grab_pending()
1293 * A delayed work item cannot be grabbed directly because in try_to_grab_pending()
1294 * it might have linked NO_COLOR work items which, if left in try_to_grab_pending()
1296 * management later on and cause stall. Make sure the work in try_to_grab_pending()
1299 if (*work_data_bits(work) & WORK_STRUCT_DELAYED) in try_to_grab_pending()
1300 pwq_activate_delayed_work(work); in try_to_grab_pending()
1302 list_del_init(&work->entry); in try_to_grab_pending()
1303 pwq_dec_nr_in_flight(pwq, get_work_color(work)); in try_to_grab_pending()
1305 /* work->data points to pwq iff queued, point to pool */ in try_to_grab_pending()
1306 set_work_pool_and_keep_pending(work, pool->id); in try_to_grab_pending()
1316 if (work_is_canceling(work)) in try_to_grab_pending()
1323 * insert_work - insert a work into a pool
1324 * @pwq: pwq @work belongs to
1325 * @work: work to insert
1329 * Insert @work which belongs to @pwq after @head. @extra_flags is or'd to
1335 static void insert_work(struct pool_workqueue *pwq, struct work_struct *work, in insert_work() argument
1340 /* we own @work, set data and link */ in insert_work()
1341 set_work_pwq(work, pwq, extra_flags); in insert_work()
1342 list_add_tail(&work->entry, head); in insert_work()
1357 * Test whether @work is being queued from another work executing on the
1366 * Return %true iff I'm a worker executing a work item on @wq. If in is_chained_work()
1373 * When queueing an unbound work item to a wq, prefer local CPU if allowed
1406 struct work_struct *work) in __queue_work() argument
1415 * While a work item is PENDING && off queue, a task trying to in __queue_work()
1429 /* pwq which will be used unless @work is executing elsewhere */ in __queue_work()
1441 * If @work was previously on a different pool, it might still be in __queue_work()
1442 * running there, in which case the work needs to be queued on that in __queue_work()
1445 last_pool = get_work_pool(work); in __queue_work()
1451 worker = find_worker_executing_work(last_pool, work); in __queue_work()
1469 * work items are executing on it, so the retrying is guaranteed to in __queue_work()
1484 trace_workqueue_queue_work(req_cpu, pwq, work); in __queue_work()
1486 if (WARN_ON(!list_empty(&work->entry))) in __queue_work()
1493 trace_workqueue_activate_work(work); in __queue_work()
1503 debug_work_activate(work); in __queue_work()
1504 insert_work(pwq, work, worklist, work_flags); in __queue_work()
1512 * queue_work_on - queue work on specific cpu
1513 * @cpu: CPU number to execute work on
1515 * @work: work to queue
1517 * We queue the work to a specific CPU, the caller must ensure it
1520 * Return: %false if @work was already on a queue, %true otherwise.
1523 struct work_struct *work) in queue_work_on() argument
1530 if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { in queue_work_on()
1531 __queue_work(cpu, wq, work); in queue_work_on()
1547 * available CPU if we need to schedule this work.
1574 * queue_work_node - queue work on a "random" cpu for a given NUMA node
1575 * @node: NUMA node that we are targeting the work for
1577 * @work: work to queue
1579 * We queue the work to a "random" CPU within a given NUMA node. The basic
1580 * idea here is to provide a way to somehow associate work with a given
1591 * Return: %false if @work was already on a queue, %true otherwise.
1594 struct work_struct *work) in queue_work_node() argument
1612 if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { in queue_work_node()
1615 __queue_work(cpu, wq, work); in queue_work_node()
1629 __queue_work(dwork->cpu, dwork->wq, &dwork->work); in delayed_work_timer_fn()
1637 struct work_struct *work = &dwork->work; in __queue_delayed_work() local
1642 WARN_ON_ONCE(!list_empty(&work->entry)); in __queue_delayed_work()
1645 * If @delay is 0, queue @dwork->work immediately. This is for in __queue_delayed_work()
1651 __queue_work(cpu, wq, &dwork->work); in __queue_delayed_work()
1666 * queue_delayed_work_on - queue work on specific CPU after delay
1667 * @cpu: CPU number to execute work on
1669 * @dwork: work to queue
1672 * Return: %false if @work was already on a queue, %true otherwise. If
1679 struct work_struct *work = &dwork->work; in queue_delayed_work_on() local
1686 if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { in queue_delayed_work_on()
1697 * mod_delayed_work_on - modify delay of or queue a delayed work on specific CPU
1698 * @cpu: CPU number to execute work on
1700 * @dwork: work to queue
1705 * zero, @work is guaranteed to be scheduled immediately regardless of its
1721 ret = try_to_grab_pending(&dwork->work, true, &flags); in mod_delayed_work_on()
1740 __queue_work(WORK_CPU_UNBOUND, rwork->wq, &rwork->work); in rcu_work_rcufn()
1745 * queue_rcu_work - queue work after a RCU grace period
1747 * @rwork: work to queue
1756 struct work_struct *work = &rwork->work; in queue_rcu_work() local
1758 if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { in queue_rcu_work()
2021 static void send_mayday(struct work_struct *work) in send_mayday() argument
2023 struct pool_workqueue *pwq = get_work_pwq(work); in send_mayday()
2047 struct work_struct *work; in pool_mayday_timeout() local
2059 list_for_each_entry(work, &pool->worklist, entry) in pool_mayday_timeout()
2060 send_mayday(work); in pool_mayday_timeout()
2159 * process_one_work - process single work
2161 * @work: work to process
2163 * Process @work. This function contains all the logics necessary to
2164 * process a single work including synchronization against and
2167 * call this function to process a work.
2172 static void process_one_work(struct worker *worker, struct work_struct *work) in process_one_work() argument
2176 struct pool_workqueue *pwq = get_work_pwq(work); in process_one_work()
2187 * work->lockdep_map, make a copy and use that here. in process_one_work()
2191 lockdep_copy_map(&lockdep_map, &work->lockdep_map); in process_one_work()
2198 * A single work shouldn't be executed concurrently by in process_one_work()
2200 * already processing the work. If so, defer the work to the in process_one_work()
2203 collision = find_worker_executing_work(pool, work); in process_one_work()
2205 move_linked_works(work, &collision->scheduled, NULL); in process_one_work()
2210 debug_work_deactivate(work); in process_one_work()
2211 hash_add(pool->busy_hash, &worker->hentry, (unsigned long)work); in process_one_work()
2212 worker->current_work = work; in process_one_work()
2213 worker->current_func = work->func; in process_one_work()
2215 work_color = get_work_color(work); in process_one_work()
2223 list_del_init(&work->entry); in process_one_work()
2229 * execution of the pending work items. in process_one_work()
2238 * pending work items for WORKER_NOT_RUNNING workers such as the in process_one_work()
2246 * update to @work. Also, do this inside @pool->lock so that in process_one_work()
2250 set_work_pool_and_clear_pending(work, pool->id); in process_one_work()
2269 * read-recursive acquire on the work(queue) 'locks', but this will then in process_one_work()
2278 trace_workqueue_execute_start(work); in process_one_work()
2279 worker->current_func(work); in process_one_work()
2281 * While we must be careful to not use "work" after this, the trace in process_one_work()
2284 trace_workqueue_execute_end(work, worker->current_func); in process_one_work()
2299 * kernels, where a requeueing work item waiting for something to in process_one_work()
2300 * happen could deadlock with stop_machine as such work item could in process_one_work()
2329 * may change while processing a work, so this function repeatedly
2330 * fetches a work from the top and executes it.
2339 struct work_struct *work = list_first_entry(&worker->scheduled, in process_scheduled_works() local
2341 process_one_work(worker, work); in process_scheduled_works()
2361 * work items regardless of their specific target workqueue. The only
2362 * exception is work items which belong to workqueues with a rescuer which
2402 * preparing to process a work or actually processing it. in worker_thread()
2417 struct work_struct *work = in worker_thread() local
2423 if (likely(!(*work_data_bits(work) & WORK_STRUCT_LINKED))) { in worker_thread()
2425 process_one_work(worker, work); in worker_thread()
2429 move_linked_works(work, &worker->scheduled, NULL); in worker_thread()
2437 * pool->lock is held and there's no work to process and no need to in worker_thread()
2457 * Regular work processing on a pool may block trying to create a new
2490 * shouldn't have any work pending, but @wq->maydays may still have in rescuer_thread()
2492 * all the work items before the rescuer got to them. Go through in rescuer_thread()
2505 struct work_struct *work, *n; in rescuer_thread() local
2522 list_for_each_entry_safe(work, n, &pool->worklist, entry) { in rescuer_thread()
2523 if (get_work_pwq(work) == pwq) { in rescuer_thread()
2526 move_linked_works(work, scheduled, &n); in rescuer_thread()
2535 * The above execution of rescued work items could in rescuer_thread()
2539 * that such back-to-back work items, which may be in rescuer_thread()
2595 * @target_work: work item being flushed (NULL for workqueue flushes)
2625 struct work_struct work; member
2630 static void wq_barrier_func(struct work_struct *work) in wq_barrier_func() argument
2632 struct wq_barrier *barr = container_of(work, struct wq_barrier, work); in wq_barrier_func()
2637 * insert_wq_barrier - insert a barrier work
2640 * @target: target work to attach @barr to
2649 * try_to_grab_pending() can't determine whether the work to be
2651 * flag of the previous work while there must be a valid next work
2652 * after a work with LINKED flag set.
2673 INIT_WORK_ONSTACK(&barr->work, wq_barrier_func); in insert_wq_barrier()
2674 __set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&barr->work)); in insert_wq_barrier()
2695 debug_work_activate(&barr->work); in insert_wq_barrier()
2696 insert_work(pwq, &barr->work, head, in insert_wq_barrier()
2704 * @work_color: new work color, < 0 for no-op
2772 * flush_workqueue - ensure that any scheduled work has run to completion.
2775 * This function sleeps until all work items which were queued on entry
2935 * work items on @wq can queue further work items on it. @wq is flushed
2984 static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr, in start_flush_work() argument
2994 pool = get_work_pool(work); in start_flush_work()
3002 pwq = get_work_pwq(work); in start_flush_work()
3007 worker = find_worker_executing_work(pool, work); in start_flush_work()
3013 check_flush_dependency(pwq->wq, work); in start_flush_work()
3015 insert_wq_barrier(pwq, barr, work, worker); in start_flush_work()
3022 * For single threaded workqueues the deadlock happens when the work in start_flush_work()
3023 * is after the work issuing the flush_work(). For rescuer equipped in start_flush_work()
3040 static bool __flush_work(struct work_struct *work, bool from_cancel) in __flush_work() argument
3047 if (WARN_ON(!work->func)) in __flush_work()
3051 lock_map_acquire(&work->lockdep_map); in __flush_work()
3052 lock_map_release(&work->lockdep_map); in __flush_work()
3055 if (start_flush_work(work, &barr, from_cancel)) { in __flush_work()
3057 destroy_work_on_stack(&barr.work); in __flush_work()
3065 * flush_work - wait for a work to finish executing the last queueing instance
3066 * @work: the work to flush
3068 * Wait until @work has finished execution. @work is guaranteed to be idle
3072 * %true if flush_work() waited for the work to finish execution,
3075 bool flush_work(struct work_struct *work) in flush_work() argument
3077 return __flush_work(work, false); in flush_work()
3083 struct work_struct *work; member
3090 if (cwait->work != key) in cwt_wakefn()
3095 static bool __cancel_work_timer(struct work_struct *work, bool is_dwork) in __cancel_work_timer() argument
3102 ret = try_to_grab_pending(work, is_dwork, &flags); in __cancel_work_timer()
3105 * finish. flush_work() doesn't work for PREEMPT_NONE in __cancel_work_timer()
3106 * because we may get scheduled between @work's completion in __cancel_work_timer()
3109 * as @work is no longer busy, try_to_grab_pending() will in __cancel_work_timer()
3110 * return -ENOENT as @work is still being canceled and the in __cancel_work_timer()
3116 * wake function which matches @work along with exclusive in __cancel_work_timer()
3124 cwait.work = work; in __cancel_work_timer()
3128 if (work_is_canceling(work)) in __cancel_work_timer()
3134 /* tell other tasks trying to grab @work to back off */ in __cancel_work_timer()
3135 mark_work_canceling(work); in __cancel_work_timer()
3139 * This allows canceling during early boot. We know that @work in __cancel_work_timer()
3143 __flush_work(work, true); in __cancel_work_timer()
3145 clear_work_data(work); in __cancel_work_timer()
3154 __wake_up(&cancel_waitq, TASK_NORMAL, 1, work); in __cancel_work_timer()
3160 * cancel_work_sync - cancel a work and wait for it to finish
3161 * @work: the work to cancel
3163 * Cancel @work and wait for its execution to finish. This function
3164 * can be used even if the work re-queues itself or migrates to
3165 * another workqueue. On return from this function, @work is
3168 * cancel_work_sync(&delayed_work->work) must not be used for
3171 * The caller must ensure that the workqueue on which @work was last
3175 * %true if @work was pending, %false otherwise.
3177 bool cancel_work_sync(struct work_struct *work) in cancel_work_sync() argument
3179 return __cancel_work_timer(work, false); in cancel_work_sync()
3185 * @dwork: the delayed work to flush
3187 * Delayed timer is cancelled and the pending work is queued for
3192 * %true if flush_work() waited for the work to finish execution,
3199 __queue_work(dwork->cpu, dwork->wq, &dwork->work); in flush_delayed_work()
3201 return flush_work(&dwork->work); in flush_delayed_work()
3207 * @rwork: the rcu work to flush
3210 * %true if flush_rcu_work() waited for the work to finish execution,
3215 if (test_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&rwork->work))) { in flush_rcu_work()
3217 flush_work(&rwork->work); in flush_rcu_work()
3220 return flush_work(&rwork->work); in flush_rcu_work()
3225 static bool __cancel_work(struct work_struct *work, bool is_dwork) in __cancel_work() argument
3231 ret = try_to_grab_pending(work, is_dwork, &flags); in __cancel_work()
3237 set_work_pool_and_clear_pending(work, get_work_pool_id(work)); in __cancel_work()
3243 * cancel_delayed_work - cancel a delayed work
3252 * The work callback function may still be running on return, unless
3253 * it returns %true and the work doesn't re-arm itself. Explicitly flush or
3260 return __cancel_work(&dwork->work, true); in cancel_delayed_work()
3265 * cancel_delayed_work_sync - cancel a delayed work and wait for it to finish
3266 * @dwork: the delayed work cancel
3275 return __cancel_work_timer(&dwork->work, true); in cancel_delayed_work_sync()
3302 struct work_struct *work = per_cpu_ptr(works, cpu); in schedule_on_each_cpu() local
3304 INIT_WORK(work, func); in schedule_on_each_cpu()
3305 schedule_work_on(cpu, work); in schedule_on_each_cpu()
3319 * @ew: guaranteed storage for the execute work structure (must
3320 * be available when the work executes)
3331 fn(&ew->work); in execute_in_process_context()
3335 INIT_WORK(&ew->work, fn); in execute_in_process_context()
3336 schedule_work(&ew->work); in execute_in_process_context()
3676 static void pwq_unbound_release_workfn(struct work_struct *work) in pwq_unbound_release_workfn() argument
3678 struct pool_workqueue *pwq = container_of(work, struct pool_workqueue, in pwq_unbound_release_workfn()
3719 * workqueue's saved_max_active and activate delayed work items
3758 * let's kick iff work items were activated. in pwq_adjust_max_active()
4067 * possibles CPUs in @attrs->cpumask so that work items are affine to the
4068 * NUMA node it was issued on. Older pwqs are released as in-flight work
4069 * items finish. Note that a work item which repeatedly requeues itself
4108 * already executing the work items for the workqueue will lose their CPU
4111 * affinity, it's the user's responsibility to flush the work item from
4378 * Safely destroy a workqueue. All work currently pending will be done first.
4500 * current_work - retrieve %current task's work struct
4505 * Return: work struct if %current task is a workqueue worker, %NULL otherwise.
4519 * work functions to determine whether it's being run off the rescuer task.
4573 * work_busy - test whether a work is currently pending or running
4574 * @work: the work to be tested
4576 * Test whether @work is currently pending or running. There is no
4583 unsigned int work_busy(struct work_struct *work) in work_busy() argument
4589 if (work_pending(work)) in work_busy()
4593 pool = get_work_pool(work); in work_busy()
4596 if (find_worker_executing_work(pool, work)) in work_busy()
4607 * set_worker_desc - set description for the current work item
4611 * This function can be called by a running work function to describe what
4612 * the work item is about. If the worker task gets dumped, this
4634 * If @task is a worker and currently executing a work item, print out the
4636 * set_worker_desc() by the currently executing work item.
4686 static void pr_cont_work(bool comma, struct work_struct *work) in pr_cont_work() argument
4688 if (work->func == wq_barrier_func) { in pr_cont_work()
4691 barr = container_of(work, struct wq_barrier, work); in pr_cont_work()
4696 pr_cont("%s %ps", comma ? "," : "", work->func); in pr_cont_work()
4703 struct work_struct *work; in show_pwq() local
4733 list_for_each_entry(work, &worker->scheduled, entry) in show_pwq()
4734 pr_cont_work(false, work); in show_pwq()
4740 list_for_each_entry(work, &pool->worklist, entry) { in show_pwq()
4741 if (get_work_pwq(work) == pwq) { in show_pwq()
4750 list_for_each_entry(work, &pool->worklist, entry) { in show_pwq()
4751 if (get_work_pwq(work) != pwq) in show_pwq()
4754 pr_cont_work(comma, work); in show_pwq()
4755 comma = !(*work_data_bits(work) & WORK_STRUCT_LINKED); in show_pwq()
4764 list_for_each_entry(work, &pwq->delayed_works, entry) { in show_pwq()
4765 pr_cont_work(comma, work); in show_pwq()
4766 comma = !(*work_data_bits(work) & WORK_STRUCT_LINKED); in show_pwq()
4898 * are a lot of assumptions on strong associations among work, pwq and
4954 * unbound chain execution of currently pending work items. in unbind_workers()
4995 * work. Kick all idle workers so that they migrate to the in rebind_workers()
5115 struct work_struct work; member
5121 static void work_for_cpu_fn(struct work_struct *work) in work_for_cpu_fn() argument
5123 struct work_for_cpu *wfc = container_of(work, struct work_for_cpu, work); in work_for_cpu_fn()
5143 INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); in work_on_cpu()
5144 schedule_work_on(cpu, &wfc.work); in work_on_cpu()
5145 flush_work(&wfc.work); in work_on_cpu()
5146 destroy_work_on_stack(&wfc.work); in work_on_cpu()
5381 * max_active RW int : maximum number of in-flight work items
5750 * flush dependency, a concurrency managed work item which stays RUNNING
5949 * and allows early boot code to create workqueues and queue/cancel work
5950 * items. Actual work item execution starts only after kthreads can be
6027 * Workqueues have been created and work items queued on them, but there
6028 * are no kworkers executing the work items yet. Populate the worker pools