* [PATCH] Remove WQ_CPU_INTENSIVE flag from unbound wq's
@ 2020-02-13 14:18 Maksym Planeta
2020-02-13 15:36 ` Mike Snitzer
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Maksym Planeta @ 2020-02-13 14:18 UTC (permalink / raw)
To: mplaneta, Zhou Wang, Herbert Xu, David S. Miller,
Alasdair Kergon, Mike Snitzer, dm-devel, Song Liu, Gao Xiang,
Chao Yu, linux-crypto, linux-kernel, linux-raid, linux-erofs
The documentation [1] says that WQ_CPU_INTENSIVE is "meaningless" for
unbound wq. I remove this flag from places where unbound queue is
allocated. This is supposed to improve code readability.
1. https://www.kernel.org/doc/html/latest/core-api/workqueue.html#flags
Signed-off-by: Maksym Planeta <mplaneta@os.inf.tu-dresden.de>
---
drivers/crypto/hisilicon/qm.c | 3 +--
drivers/md/dm-crypt.c | 2 +-
drivers/md/dm-verity-target.c | 2 +-
drivers/md/raid5.c | 2 +-
fs/erofs/zdata.c | 2 +-
5 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index b57da5ef8b5b..4a39cb2c6a0b 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -1148,8 +1148,7 @@ struct hisi_qp *hisi_qm_create_qp(struct hisi_qm *qm, u8 alg_type)
qp->qp_id = qp_id;
qp->alg_type = alg_type;
INIT_WORK(&qp->work, qm_qp_work_func);
- qp->wq = alloc_workqueue("hisi_qm", WQ_UNBOUND | WQ_HIGHPRI |
- WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, 0);
+ qp->wq = alloc_workqueue("hisi_qm", WQ_UNBOUND | WQ_HIGHPRI | WQ_MEM_RECLAIM, 0);
if (!qp->wq) {
ret = -EFAULT;
goto err_free_qp_mem;
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index c6a529873d0f..44d56325fa27 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -3032,7 +3032,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1, devname);
else
cc->crypt_queue = alloc_workqueue("kcryptd/%s",
- WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM | WQ_UNBOUND,
+ WQ_MEM_RECLAIM | WQ_UNBOUND,
num_online_cpus(), devname);
if (!cc->crypt_queue) {
ti->error = "Couldn't create kcryptd queue";
diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index 0d61e9c67986..20f92c7ea07e 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -1190,7 +1190,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
}
/* WQ_UNBOUND greatly improves performance when running on ramdisk */
- v->verify_wq = alloc_workqueue("kverityd", WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM | WQ_UNBOUND, num_online_cpus());
+ v->verify_wq = alloc_workqueue("kverityd", WQ_MEM_RECLAIM | WQ_UNBOUND, num_online_cpus());
if (!v->verify_wq) {
ti->error = "Cannot allocate workqueue";
r = -ENOMEM;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index ba00e9877f02..cd93a1731b82 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -8481,7 +8481,7 @@ static int __init raid5_init(void)
int ret;
raid5_wq = alloc_workqueue("raid5wq",
- WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE|WQ_SYSFS, 0);
+ WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_SYSFS, 0);
if (!raid5_wq)
return -ENOMEM;
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index 80e47f07d946..b2a679f720e9 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -43,7 +43,7 @@ void z_erofs_exit_zip_subsystem(void)
static inline int z_erofs_init_workqueue(void)
{
const unsigned int onlinecpus = num_possible_cpus();
- const unsigned int flags = WQ_UNBOUND | WQ_HIGHPRI | WQ_CPU_INTENSIVE;
+ const unsigned int flags = WQ_UNBOUND | WQ_HIGHPRI;
/*
* no need to spawn too many threads, limiting threads could minimum
--
2.24.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: Remove WQ_CPU_INTENSIVE flag from unbound wq's
2020-02-13 14:18 [PATCH] Remove WQ_CPU_INTENSIVE flag from unbound wq's Maksym Planeta
@ 2020-02-13 15:36 ` Mike Snitzer
2020-02-13 16:19 ` Maksym Planeta
2020-02-14 1:39 ` [PATCH] " Gao Xiang
2020-02-14 3:47 ` Zhou Wang
2 siblings, 1 reply; 6+ messages in thread
From: Mike Snitzer @ 2020-02-13 15:36 UTC (permalink / raw)
To: Maksym Planeta
Cc: Herbert Xu, dm-devel, linux-kernel, linux-raid, Song Liu,
Zhou Wang, linux-crypto, Gao Xiang, linux-erofs, David S. Miller,
Alasdair Kergon
On Thu, Feb 13 2020 at 9:18am -0500,
Maksym Planeta <mplaneta@os.inf.tu-dresden.de> wrote:
> The documentation [1] says that WQ_CPU_INTENSIVE is "meaningless" for
> unbound wq. I remove this flag from places where unbound queue is
> allocated. This is supposed to improve code readability.
>
> 1. https://www.kernel.org/doc/html/latest/core-api/workqueue.html#flags
>
> Signed-off-by: Maksym Planeta <mplaneta@os.inf.tu-dresden.de>
What the Documentation says aside, have you cross referenced with the
code? And/or have you done benchmarks to verify no changes?
Thanks,
Mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Remove WQ_CPU_INTENSIVE flag from unbound wq's
2020-02-13 15:36 ` Mike Snitzer
@ 2020-02-13 16:19 ` Maksym Planeta
2020-02-13 23:42 ` Song Liu
0 siblings, 1 reply; 6+ messages in thread
From: Maksym Planeta @ 2020-02-13 16:19 UTC (permalink / raw)
To: Mike Snitzer
Cc: Herbert Xu, dm-devel, linux-kernel, linux-raid, Song Liu,
Zhou Wang, linux-crypto, Gao Xiang, linux-erofs, David S. Miller,
Alasdair Kergon
On 13/02/2020 16:36, Mike Snitzer wrote:
> On Thu, Feb 13 2020 at 9:18am -0500,
> Maksym Planeta <mplaneta@os.inf.tu-dresden.de> wrote:
>
>> The documentation [1] says that WQ_CPU_INTENSIVE is "meaningless" for
>> unbound wq. I remove this flag from places where unbound queue is
>> allocated. This is supposed to improve code readability.
>>
>> 1. https://www.kernel.org/doc/html/latest/core-api/workqueue.html#flags
>>
>> Signed-off-by: Maksym Planeta <mplaneta@os.inf.tu-dresden.de>
>
> What the Documentation says aside, have you cross referenced with the
> code? And/or have you done benchmarks to verify no changes?
>
It seems so from the code. Although, I'm not 100% confident. I did not
run benchmarks, instead I relied that on the assumption that
documentation is correct.
> Thanks,
> Mike
>
--
Regards,
Maksym Planeta
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Remove WQ_CPU_INTENSIVE flag from unbound wq's
2020-02-13 16:19 ` Maksym Planeta
@ 2020-02-13 23:42 ` Song Liu
0 siblings, 0 replies; 6+ messages in thread
From: Song Liu @ 2020-02-13 23:42 UTC (permalink / raw)
To: Maksym Planeta
Cc: Herbert Xu, Mike Snitzer, Zhou Wang, open list, linux-raid,
dm-devel, linux-crypto, Gao Xiang, linux-erofs, David S. Miller,
Alasdair Kergon
On Thu, Feb 13, 2020 at 8:19 AM Maksym Planeta
<mplaneta@os.inf.tu-dresden.de> wrote:
>
>
>
> On 13/02/2020 16:36, Mike Snitzer wrote:
> > On Thu, Feb 13 2020 at 9:18am -0500,
> > Maksym Planeta <mplaneta@os.inf.tu-dresden.de> wrote:
> >
> >> The documentation [1] says that WQ_CPU_INTENSIVE is "meaningless" for
> >> unbound wq. I remove this flag from places where unbound queue is
> >> allocated. This is supposed to improve code readability.
> >>
> >> 1. https://www.kernel.org/doc/html/latest/core-api/workqueue.html#flags
> >>
> >> Signed-off-by: Maksym Planeta <mplaneta@os.inf.tu-dresden.de>
> >
> > What the Documentation says aside, have you cross referenced with the
> > code? And/or have you done benchmarks to verify no changes?
> >
>
> It seems so from the code. Although, I'm not 100% confident. I did not
> run benchmarks, instead I relied that on the assumption that
> documentation is correct.
From the code, WQ_CPU_INTENSIVE is only used to set
WORKER_CPU_INTENSIVE, and WORKER_CPU_INTENSIVE is only used
as part of WORKER_NOT_RUNNING, which includes WORKER_UNBOUND.
So, I agree that with current code, WQ_CPU_INTENSIVE with WQ_UNBOUND
is same as WQ_UNBOUND alone.
However, I don't think it is necessary to make the changes. They don't really
improve readability of the code.
Thanks,
Song
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Remove WQ_CPU_INTENSIVE flag from unbound wq's
2020-02-13 14:18 [PATCH] Remove WQ_CPU_INTENSIVE flag from unbound wq's Maksym Planeta
2020-02-13 15:36 ` Mike Snitzer
@ 2020-02-14 1:39 ` Gao Xiang
2020-02-14 3:47 ` Zhou Wang
2 siblings, 0 replies; 6+ messages in thread
From: Gao Xiang @ 2020-02-14 1:39 UTC (permalink / raw)
To: Maksym Planeta
Cc: Herbert Xu, Mike Snitzer, dm-devel, linux-kernel, linux-raid,
Song Liu, Zhou Wang, linux-crypto, Gao Xiang, linux-erofs,
David S. Miller, Alasdair Kergon
On Thu, Feb 13, 2020 at 03:18:23PM +0100, Maksym Planeta wrote:
> The documentation [1] says that WQ_CPU_INTENSIVE is "meaningless" for
> unbound wq. I remove this flag from places where unbound queue is
> allocated. This is supposed to improve code readability.
>
> 1. https://www.kernel.org/doc/html/latest/core-api/workqueue.html#flags
>
> Signed-off-by: Maksym Planeta <mplaneta@os.inf.tu-dresden.de>
> ---
> drivers/crypto/hisilicon/qm.c | 3 +--
> drivers/md/dm-crypt.c | 2 +-
> drivers/md/dm-verity-target.c | 2 +-
> drivers/md/raid5.c | 2 +-
> fs/erofs/zdata.c | 2 +-
I'm okay for EROFS part,
Acked-by: Gao Xiang <gaoxiang25@huawei.com>
Thanks,
Gao Xiang
> 5 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
> index b57da5ef8b5b..4a39cb2c6a0b 100644
> --- a/drivers/crypto/hisilicon/qm.c
> +++ b/drivers/crypto/hisilicon/qm.c
> @@ -1148,8 +1148,7 @@ struct hisi_qp *hisi_qm_create_qp(struct hisi_qm *qm, u8 alg_type)
> qp->qp_id = qp_id;
> qp->alg_type = alg_type;
> INIT_WORK(&qp->work, qm_qp_work_func);
> - qp->wq = alloc_workqueue("hisi_qm", WQ_UNBOUND | WQ_HIGHPRI |
> - WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, 0);
> + qp->wq = alloc_workqueue("hisi_qm", WQ_UNBOUND | WQ_HIGHPRI | WQ_MEM_RECLAIM, 0);
> if (!qp->wq) {
> ret = -EFAULT;
> goto err_free_qp_mem;
> diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
> index c6a529873d0f..44d56325fa27 100644
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -3032,7 +3032,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
> 1, devname);
> else
> cc->crypt_queue = alloc_workqueue("kcryptd/%s",
> - WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM | WQ_UNBOUND,
> + WQ_MEM_RECLAIM | WQ_UNBOUND,
> num_online_cpus(), devname);
> if (!cc->crypt_queue) {
> ti->error = "Couldn't create kcryptd queue";
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index 0d61e9c67986..20f92c7ea07e 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -1190,7 +1190,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
> }
>
> /* WQ_UNBOUND greatly improves performance when running on ramdisk */
> - v->verify_wq = alloc_workqueue("kverityd", WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM | WQ_UNBOUND, num_online_cpus());
> + v->verify_wq = alloc_workqueue("kverityd", WQ_MEM_RECLAIM | WQ_UNBOUND, num_online_cpus());
> if (!v->verify_wq) {
> ti->error = "Cannot allocate workqueue";
> r = -ENOMEM;
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index ba00e9877f02..cd93a1731b82 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -8481,7 +8481,7 @@ static int __init raid5_init(void)
> int ret;
>
> raid5_wq = alloc_workqueue("raid5wq",
> - WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE|WQ_SYSFS, 0);
> + WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_SYSFS, 0);
> if (!raid5_wq)
> return -ENOMEM;
>
> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
> index 80e47f07d946..b2a679f720e9 100644
> --- a/fs/erofs/zdata.c
> +++ b/fs/erofs/zdata.c
> @@ -43,7 +43,7 @@ void z_erofs_exit_zip_subsystem(void)
> static inline int z_erofs_init_workqueue(void)
> {
> const unsigned int onlinecpus = num_possible_cpus();
> - const unsigned int flags = WQ_UNBOUND | WQ_HIGHPRI | WQ_CPU_INTENSIVE;
> + const unsigned int flags = WQ_UNBOUND | WQ_HIGHPRI;
>
> /*
> * no need to spawn too many threads, limiting threads could minimum
> --
> 2.24.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Remove WQ_CPU_INTENSIVE flag from unbound wq's
2020-02-13 14:18 [PATCH] Remove WQ_CPU_INTENSIVE flag from unbound wq's Maksym Planeta
2020-02-13 15:36 ` Mike Snitzer
2020-02-14 1:39 ` [PATCH] " Gao Xiang
@ 2020-02-14 3:47 ` Zhou Wang
2 siblings, 0 replies; 6+ messages in thread
From: Zhou Wang @ 2020-02-14 3:47 UTC (permalink / raw)
To: Maksym Planeta, Herbert Xu, David S. Miller, Alasdair Kergon,
Mike Snitzer, dm-devel, Song Liu, Gao Xiang, Chao Yu,
linux-crypto, linux-kernel, linux-raid, linux-erofs
On 2020/2/13 22:18, Maksym Planeta wrote:
> The documentation [1] says that WQ_CPU_INTENSIVE is "meaningless" for
> unbound wq. I remove this flag from places where unbound queue is
> allocated. This is supposed to improve code readability.
>
> 1. https://www.kernel.org/doc/html/latest/core-api/workqueue.html#flags
>
> Signed-off-by: Maksym Planeta <mplaneta@os.inf.tu-dresden.de>
> ---
> drivers/crypto/hisilicon/qm.c | 3 +--
> drivers/md/dm-crypt.c | 2 +-
> drivers/md/dm-verity-target.c | 2 +-
> drivers/md/raid5.c | 2 +-
> fs/erofs/zdata.c | 2 +-
> 5 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
> index b57da5ef8b5b..4a39cb2c6a0b 100644
> --- a/drivers/crypto/hisilicon/qm.c
> +++ b/drivers/crypto/hisilicon/qm.c
> @@ -1148,8 +1148,7 @@ struct hisi_qp *hisi_qm_create_qp(struct hisi_qm *qm, u8 alg_type)
> qp->qp_id = qp_id;
> qp->alg_type = alg_type;
> INIT_WORK(&qp->work, qm_qp_work_func);
> - qp->wq = alloc_workqueue("hisi_qm", WQ_UNBOUND | WQ_HIGHPRI |
> - WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, 0);
> + qp->wq = alloc_workqueue("hisi_qm", WQ_UNBOUND | WQ_HIGHPRI | WQ_MEM_RECLAIM, 0);
I am OK with qm code.
Thanks!
Zhou
> if (!qp->wq) {
> ret = -EFAULT;
> goto err_free_qp_mem;
> diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
> index c6a529873d0f..44d56325fa27 100644
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -3032,7 +3032,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
> 1, devname);
> else
> cc->crypt_queue = alloc_workqueue("kcryptd/%s",
> - WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM | WQ_UNBOUND,
> + WQ_MEM_RECLAIM | WQ_UNBOUND,
> num_online_cpus(), devname);
> if (!cc->crypt_queue) {
> ti->error = "Couldn't create kcryptd queue";
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index 0d61e9c67986..20f92c7ea07e 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -1190,7 +1190,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
> }
>
> /* WQ_UNBOUND greatly improves performance when running on ramdisk */
> - v->verify_wq = alloc_workqueue("kverityd", WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM | WQ_UNBOUND, num_online_cpus());
> + v->verify_wq = alloc_workqueue("kverityd", WQ_MEM_RECLAIM | WQ_UNBOUND, num_online_cpus());
> if (!v->verify_wq) {
> ti->error = "Cannot allocate workqueue";
> r = -ENOMEM;
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index ba00e9877f02..cd93a1731b82 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -8481,7 +8481,7 @@ static int __init raid5_init(void)
> int ret;
>
> raid5_wq = alloc_workqueue("raid5wq",
> - WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE|WQ_SYSFS, 0);
> + WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_SYSFS, 0);
> if (!raid5_wq)
> return -ENOMEM;
>
> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
> index 80e47f07d946..b2a679f720e9 100644
> --- a/fs/erofs/zdata.c
> +++ b/fs/erofs/zdata.c
> @@ -43,7 +43,7 @@ void z_erofs_exit_zip_subsystem(void)
> static inline int z_erofs_init_workqueue(void)
> {
> const unsigned int onlinecpus = num_possible_cpus();
> - const unsigned int flags = WQ_UNBOUND | WQ_HIGHPRI | WQ_CPU_INTENSIVE;
> + const unsigned int flags = WQ_UNBOUND | WQ_HIGHPRI;
>
> /*
> * no need to spawn too many threads, limiting threads could minimum
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-02-14 4:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13 14:18 [PATCH] Remove WQ_CPU_INTENSIVE flag from unbound wq's Maksym Planeta
2020-02-13 15:36 ` Mike Snitzer
2020-02-13 16:19 ` Maksym Planeta
2020-02-13 23:42 ` Song Liu
2020-02-14 1:39 ` [PATCH] " Gao Xiang
2020-02-14 3:47 ` Zhou Wang
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).