From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
Johannes Thumshirn <jth@kernel.org>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 03/10] btrfs: offload all write I/O completions to a workqueue
Date: Wed, 22 Mar 2023 07:37:07 +0800 [thread overview]
Message-ID: <5eebb0fc-0be3-c313-27cd-4e11a7b04405@gmx.com> (raw)
In-Reply-To: <20230321125550.GB10470@lst.de>
On 2023/3/21 20:55, Christoph Hellwig wrote:
> On Tue, Mar 21, 2023 at 07:37:46AM +0800, Qu Wenruo wrote:
>>> I think it is stalled. That's why the workqueue heavily discourages
>>> limiting max_active unless you have a good reason to, and most callers
>>> follow that advise.
>>
>> To me, this looks more like hiding a bug in the workqueue user.
>> Shouldn't we expose such bugs instead of hiding them?
>
> If you limit max_active to a certain value, you clearly tell the
> workqueue code not not use more workers that that. That is what the
> argument is for.
And if a work load can only be deadlock free using the default
max_active, but not any value smaller, then I'd say the work load itself
is buggy.
>
> I don't see where there is a bug, and that someone is hiding it.
>
>> Furthermore although I'm a big fan of plain workqueue, the old btrfs
>> workqueues allows us to apply max_active to the plain workqueues, but now
>> we don't have this ability any more.
>
> You can pass max_active to plain Linux workqueues and there is a bunch
> of places that do that, although the vast majority passes either 0 to
> use the default, or 1 to limit themselves to a single active worker.
>
> The core also allows to change it, but nothing but the btrfs_workqueue
> code ever does. We can wire up btrfs to change the conccurency if we
> have a good reason to do. And I'd like to figure out if there is one,
> and if yes for which workqueue, but for that we'd need to have an
> argument for why which workqueue would like to use a larger or smaller
> than default value. The old argument of higher resource usage with
> a bigger number of workers does not apply any more with the concurrency
> managed workqueue implementation.
The usecase is still there.
To limit the amount of CPU time spent by btrfs workloads, from csum
verification to compression.
And if limiting max_active for plain workqueue could help us to expose
possible deadlocks, it would be extra benefits.
Thanks,
Qu
>
>>>> Personally speaking, I'd like to keep the btrfs bio endio function calls in
>>>> the old soft/hard irq context, and let the higher layer to queue the work.
>>>
>>> Can you explain why?
>>
>> Just to keep the context consistent.
>
> Which is what this series does. Before all read I/O completion handlers
> were called in workqueue context, while write ones weren't. With the
> series write completion handlers are called from workqueue context
> as well, and with that all significant btrfs code except for tiny bits
> of bi_end_io handlers are called from process context.
>
>> Image a situation, where we put some sleep functions into a endio function
>> without any doubt, and fully rely on the fact the endio function is
>> executed under workqueue context.
>
> Being able to do that is the point of this series.
next prev parent reply other threads:[~2023-03-21 23:37 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 16:59 defer all write I/O completions to process context Christoph Hellwig
2023-03-14 16:59 ` [PATCH 01/10] btrfs: use a plain workqueue for ordered_extent processing Christoph Hellwig
2023-03-16 17:10 ` Johannes Thumshirn
2023-03-16 17:31 ` David Sterba
2023-03-20 6:12 ` Christoph Hellwig
2023-03-20 11:08 ` Qu Wenruo
2023-03-20 11:35 ` Qu Wenruo
2023-03-20 12:24 ` Christoph Hellwig
2023-03-20 23:19 ` Qu Wenruo
2023-03-21 12:48 ` Christoph Hellwig
2023-03-14 16:59 ` [PATCH 02/10] btrfs: refactor btrfs_end_io_wq Christoph Hellwig
2023-03-16 17:12 ` Johannes Thumshirn
2023-03-20 11:09 ` Qu Wenruo
2023-03-14 16:59 ` [PATCH 03/10] btrfs: offload all write I/O completions to a workqueue Christoph Hellwig
2023-03-16 17:14 ` Johannes Thumshirn
2023-03-20 11:29 ` Qu Wenruo
2023-03-20 12:30 ` Christoph Hellwig
2023-03-20 23:37 ` Qu Wenruo
2023-03-21 12:55 ` Christoph Hellwig
2023-03-21 23:37 ` Qu Wenruo [this message]
2023-03-22 8:32 ` Christoph Hellwig
2023-03-23 8:07 ` Qu Wenruo
2023-03-23 8:12 ` Christoph Hellwig
2023-03-23 8:20 ` Qu Wenruo
2023-03-24 1:11 ` Christoph Hellwig
2023-03-23 14:53 ` Chris Mason
2023-03-24 1:09 ` Christoph Hellwig
2023-03-24 13:25 ` Chris Mason
2023-03-24 19:20 ` Chris Mason
2023-03-25 8:13 ` Christoph Hellwig
2023-03-25 17:16 ` Chris Mason
2023-03-25 8:15 ` Christoph Hellwig
2023-03-25 8:42 ` Qu Wenruo
2023-03-14 16:59 ` [PATCH 04/10] btrfs: remove the compressed_write_workers workqueue Christoph Hellwig
2023-03-14 16:59 ` [PATCH 05/10] btrfs: remove irq disabling for btrfs_workqueue.list_lock Christoph Hellwig
2023-03-17 10:34 ` Johannes Thumshirn
2023-03-14 16:59 ` [PATCH 06/10] btrfs: remove irq disabling for subpage.list_lock Christoph Hellwig
2023-03-14 16:59 ` [PATCH 07/10] btrfs: remove irq disabling for leak_lock Christoph Hellwig
2023-03-17 10:35 ` Johannes Thumshirn
2023-03-14 16:59 ` [PATCH 08/10] btrfs: remove irq disabling for fs_info.ebleak_lock Christoph Hellwig
2023-03-17 10:35 ` Johannes Thumshirn
2023-03-14 16:59 ` [PATCH 09/10] btrfs: remove irq_disabling for ordered_tree.lock Christoph Hellwig
2023-03-17 10:36 ` Johannes Thumshirn
2023-03-20 6:12 ` Christoph Hellwig
2023-03-14 16:59 ` [PATCH 10/10] btrfs: remove confusing comments Christoph Hellwig
2023-03-17 10:37 ` Johannes Thumshirn
2023-03-17 10:39 ` defer all write I/O completions to process context Johannes Thumshirn
2023-03-20 6:14 ` Christoph Hellwig
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=5eebb0fc-0be3-c313-27cd-4e11a7b04405@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=hch@lst.de \
--cc=josef@toxicpanda.com \
--cc=jth@kernel.org \
--cc=linux-btrfs@vger.kernel.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