* [PATCH] async: Using current_work() to implement current_is_async()
@ 2019-09-26 8:40 Yunfeng Ye
2019-09-26 15:27 ` Bart Van Assche
0 siblings, 1 reply; 3+ messages in thread
From: Yunfeng Ye @ 2019-09-26 8:40 UTC (permalink / raw)
To: Alexander Duyck, gregkh, bvanassche, bhelgaas, dsterba, tglx,
sakari.ailus
Cc: linux-kernel
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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] async: Using current_work() to implement current_is_async()
2019-09-26 8:40 [PATCH] async: Using current_work() to implement current_is_async() Yunfeng Ye
@ 2019-09-26 15:27 ` Bart Van Assche
2019-09-27 1:01 ` Yunfeng Ye
0 siblings, 1 reply; 3+ messages in thread
From: Bart Van Assche @ 2019-09-26 15:27 UTC (permalink / raw)
To: Yunfeng Ye, Alexander Duyck, gregkh, bhelgaas, dsterba, tglx,
sakari.ailus
Cc: linux-kernel
On 9/26/19 1:40 AM, Yunfeng Ye wrote:
> current_is_async() can be implemented using current_work(), it's better
> not to be aware of the workqueue's internal information.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] async: Using current_work() to implement current_is_async()
2019-09-26 15:27 ` Bart Van Assche
@ 2019-09-27 1:01 ` Yunfeng Ye
0 siblings, 0 replies; 3+ messages in thread
From: Yunfeng Ye @ 2019-09-27 1:01 UTC (permalink / raw)
To: Bart Van Assche, Alexander Duyck, gregkh, bhelgaas, dsterba,
tglx, sakari.ailus
Cc: linux-kernel
On 2019/9/26 23:27, Bart Van Assche wrote:
> On 9/26/19 1:40 AM, Yunfeng Ye wrote:
>> current_is_async() can be implemented using current_work(), it's better
>> not to be aware of the workqueue's internal information.
>
> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
>
I will update the patch with Reviewed-by, thanks.
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-27 1:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26 8:40 [PATCH] async: Using current_work() to implement current_is_async() Yunfeng Ye
2019-09-26 15:27 ` Bart Van Assche
2019-09-27 1:01 ` Yunfeng Ye
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).