It does not make much sense to expose worker, workqueue's internal object, to outsiders, and whatever field inside worker as well. Nor does worker pool rather than workqueue and work. Signed-off-by: Hillf Danton <hdanton@xxxxxxxx> --- --- a/kernel/workqueue_internal.h +++ b/kernel/workqueue_internal.h @@ -69,6 +69,13 @@ static inline struct worker *current_wq_ return NULL; } +static inline bool current_is_executing(work_func_t func) +{ + struct worker *worker = current_wq_worker(); + + return worker && worker->current_func == func; +} + /* * Scheduler hooks for concurrency managed workqueue. Only to be used from * sched/ and workqueue.c. --- a/kernel/async.c +++ b/kernel/async.c @@ -327,8 +327,6 @@ EXPORT_SYMBOL_GPL(async_synchronize_cook */ bool current_is_async(void) { - struct worker *worker = current_wq_worker(); - - return worker && worker->current_func == async_run_entry_fn; + return current_is_executing(async_run_entry_fn); } EXPORT_SYMBOL_GPL(current_is_async);