From: Hillf Danton <hdanton@sina.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: linux-mm <linux-mm@kvack.org>, Hillf Danton <hdanton@sina.com>
Subject: [RFC] workqueue: dexpose worker
Date: Wed, 18 Dec 2019 11:59:45 +0800 [thread overview]
Message-ID: <20191218035945.16180-1-hdanton@sina.com> (raw)
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);
next reply other threads:[~2019-12-18 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-18 3:59 Hillf Danton [this message]
2019-12-18 13:57 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191218035945.16180-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox