[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZFmK2uV6n8cJ1ec0@slm.duckdns.org>
Date: Mon, 8 May 2023 13:50:50 -1000
From: Tejun Heo <tj@...nel.org>
To: Wang Yugui <wangyugui@...-tech.com>
Cc: jiangshanlai@...il.com, linux-kernel@...r.kernel.org,
kernel-team@...a.com, Chris Mason <clm@...com>,
Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org
Subject: Re: [PATCH v2 16/22] btrfs: Use alloc_ordered_workqueue() to create
ordered workqueues
On Sat, May 06, 2023 at 09:40:14AM +0800, Wang Yugui wrote:
> by test, I noticed some warning caused by
> void workqueue_set_max_active(struct workqueue_struct *wq, int max_active)
> if (WARN_ON(wq->flags & __WQ_ORDERED_EXPLICIT))
> return;
>
> so I tested again with the flowing fix
>
> diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
> index 43c8995..e4b68e9 100644
> --- a/fs/btrfs/async-thread.c
> +++ b/fs/btrfs/async-thread.c
> @@ -99,8 +99,11 @@ struct btrfs_workqueue *btrfs_alloc_workqueue(struct btrfs_fs_info *fs_info,
> ret->thresh = thresh;
> }
>
> - ret->normal_wq = alloc_workqueue("btrfs-%s", flags, ret->current_active,
> - name);
> + if(limit_active == 1)
> + ret->normal_wq = alloc_ordered_workqueue("btrfs-%s", flags, name);
> + else
> + ret->normal_wq = alloc_workqueue("btrfs-%s", flags,
> + ret->current_active, name);
> if (!ret->normal_wq) {
> kfree(ret);
> return NULL;
> @@ -139,7 +139,7 @@ static inline void thresh_exec_hook(struct btrfs_workqueue *wq)
> long pending;
> int need_change = 0;
>
> - if (wq->thresh == NO_THRESHOLD)
> + if (wq->thresh == NO_THRESHOLD || wq->limit_active == 1)
> return;
>
> atomic_dec(&wq->pending);
>
> we need 'limit_active' at 2nd postition, so I used 'limit_active' and 1st
> postition too.
Oh, that most likely means that these workqueues don't need to and shouldn't
be ordered. Will update the patch.
Thanks.
--
tejun
Powered by blists - more mailing lists