* [RFC] workqueue: dexpose worker
@ 2019-12-18 3:59 Hillf Danton
2019-12-18 13:57 ` Michal Hocko
0 siblings, 1 reply; 2+ messages in thread
From: Hillf Danton @ 2019-12-18 3:59 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-mm, Hillf Danton
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@sina.com>
---
--- 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC] workqueue: dexpose worker
2019-12-18 3:59 [RFC] workqueue: dexpose worker Hillf Danton
@ 2019-12-18 13:57 ` Michal Hocko
0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2019-12-18 13:57 UTC (permalink / raw)
To: Hillf Danton; +Cc: linux-kernel, linux-mm, Tejun Heo, Lai Jiangshan
You probably wanted to Cc maintainers.
On Wed 18-12-19 11:59:45, Hillf Danton wrote:
>
> 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.
But I have to say that this doesn't really make much sense to me.
What is the problem you are trying to solve?
current_is_executing is a really ambiguous name without any relation to
WQ. Also this seems like a pointless code churn to me. Anyway for
maintainers to judge.
>
> Signed-off-by: Hillf Danton <hdanton@sina.com>
> ---
>
> --- 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);
>
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-18 13:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 3:59 [RFC] workqueue: dexpose worker Hillf Danton
2019-12-18 13:57 ` Michal Hocko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox