From: Yunfeng Ye <yeyunfeng@huawei.com>
To: Bart Van Assche <bvanassche@acm.org>,
Alexander Duyck <alexander.h.duyck@linux.intel.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
<bhelgaas@google.com>, David Sterba <dsterba@suse.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
<sakari.ailus@linux.intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"hushiyuan@huawei.com" <hushiyuan@huawei.com>,
"linfeilong@huawei.com" <linfeilong@huawei.com>
Subject: [PATCH v2] async: Using current_work() to implement current_is_async()
Date: Sat, 26 Oct 2019 18:56:42 +0800 [thread overview]
Message-ID: <a2896834-54c7-5842-d062-c19688b09fbb@huawei.com> (raw)
In-Reply-To: <0147097c-0ce2-5944-932a-8fd53eed4ff6@huawei.com>
current_is_async() can be implemented using current_work(), it's better
not to be aware of the workqueue's internal information.
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
v1 -> v2:
- add "Reviewed-by"
kernel/async.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/async.c b/kernel/async.c
index 1de270d..a849f98 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -53,8 +53,6 @@ asynchronous and synchronous parts of the kernel.
#include <linux/slab.h>
#include <linux/workqueue.h>
-#include "workqueue_internal.h"
-
static async_cookie_t next_cookie = 1;
#define MAX_WORK 32768
@@ -327,8 +325,8 @@ EXPORT_SYMBOL_GPL(async_synchronize_cookie);
*/
bool current_is_async(void)
{
- struct worker *worker = current_wq_worker();
+ struct work_struct *work = current_work();
- return worker && worker->current_func == async_run_entry_fn;
+ return work && work->func == async_run_entry_fn;
}
EXPORT_SYMBOL_GPL(current_is_async);
--
2.7.4
prev parent reply other threads:[~2019-10-26 10:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-27 3:29 Yunfeng Ye
2019-10-26 10:56 ` Yunfeng Ye [this message]
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=a2896834-54c7-5842-d062-c19688b09fbb@huawei.com \
--to=yeyunfeng@huawei.com \
--cc=alexander.h.duyck@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=bvanassche@acm.org \
--cc=dsterba@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=hushiyuan@huawei.com \
--cc=linfeilong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®