Lines Matching defs:works

171 	struct tsync_work **works;
199 ctx = s->works[s->size];
209 * @s: TSYNC works to trim.
223 ctx = s->works[s->size - 1];
256 struct tsync_work **works;
266 works = krealloc_array(s->works, new_capacity, sizeof(s->works[0]),
268 if (!works)
271 s->works = works;
283 s->works[i] = work;
298 if (s->works[i]->task == task)
314 if (WARN_ON_ONCE(!s->works[i]->task))
317 put_task_struct(s->works[i]->task);
321 kfree(s->works[i]);
323 kfree(s->works);
324 s->works = NULL;
330 * count_additional_threads - counts the sibling threads that are not in works
332 static size_t count_additional_threads(const struct tsync_works *works)
351 if (tsync_works_contains_task(works, thread))
369 static bool schedule_task_work(struct tsync_works *works,
392 if (tsync_works_contains_task(works, thread))
402 ctx = tsync_works_provide(works, thread);
426 tsync_works_trim(works);
437 * cancel_tsync_works - cancel all task works where it is possible
439 * Task works can be canceled as long as they are still queued and have not
444 static void cancel_tsync_works(const struct tsync_works *works,
449 for (i = 0; i < works->size; i++) {
450 if (WARN_ON_ONCE(!works->works[i]->task))
453 if (!task_work_cancel(works->works[i]->task,
454 &works->works[i]->work))
475 struct tsync_works works = {};
536 newly_discovered_threads = count_additional_threads(&works);
541 err = tsync_works_grow_by(&works, newly_discovered_threads,
554 * and mark the completion as done before all task works are registered.
564 found_more_threads = schedule_task_work(&works, &shared_ctx);
579 * works for tasks that did not start running
581 * cancels any of the enqueued task works
585 cancel_tsync_works(&works, &shared_ctx);
612 tsync_works_release(&works);