From: Dave Chinner <david@fromorbit.com>
To: Tejun Heo <tj@kernel.org>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Dan Schatzberg <schatzberg.dan@gmail.com>,
Jens Axboe <axboe@kernel.dk>, Ming Lei <ming.lei@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@lst.de>,
linux-block <linux-block@vger.kernel.org>,
linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] loop: add WQ_MEM_RECLAIM flag to per device workqueue
Date: Wed, 23 Mar 2022 09:00:07 +1100 [thread overview]
Message-ID: <20220322220007.GQ1544202@dread.disaster.area> (raw)
In-Reply-To: <Yjn+vpHZzvxiAUaK@slm.duckdns.org>
On Tue, Mar 22, 2022 at 06:52:14AM -1000, Tejun Heo wrote:
> Hello,
>
> On Tue, Mar 22, 2022 at 09:09:53AM +0900, Tetsuo Handa wrote:
> > > The legacy flushing warning is telling us that those workqueues can be
> >
> > s/can be/must be/ ?
>
> Well, one thing that we can but don't want to do is converting all
> create_workqueue() users to alloc_workqueue() with MEM_RECLAIM, which is
> wasteful but won't break anything. We know for sure that the workqueues
> which trigger the legacy warning are participating in memory reclaim and
> thus need MEM_RECLAIM. So, yeah, the warning tells us that they need
> MEM_RECLAIM and should be converted.
>
> > ? Current /* internal: create*_workqueue() */ tells me nothing.
>
> It's trying to say that it shouldn't be used outside workqueue proper and
> the warning message is supposed to trigger the conversion. But, yeah, a
> stronger comment can help.
>
> > My question is: I want to add WQ_MEM_RECLAIM flag to the WQ used by loop module
> > because this WQ is involved upon writeback operation. But unless I add both
> > __WQ_LEGACY | WQ_MEM_RECLAIM flags to the WQ used by loop module, we will hit
> >
> > WARN_ONCE(worker && ((worker->current_pwq->wq->flags &
> > (WQ_MEM_RECLAIM | __WQ_LEGACY)) == WQ_MEM_RECLAIM),
> >
> > warning because e.g. xfs-sync WQ used by xfs module is not using WQ_MEM_RECLAIM flag.
> >
> > mp->m_sync_workqueue = alloc_workqueue("xfs-sync/%s",
> > XFS_WQFLAGS(WQ_FREEZABLE), 0, mp->m_super->s_id);
> >
> > You are suggesting that the correct approach is to add WQ_MEM_RECLAIM flag to WQs
> > used by filesystems when adding WQ_MEM_RECLAIM flag to the WQ used by loop module
> > introduces possibility of hitting
> >
> > WARN_ONCE(worker && ((worker->current_pwq->wq->flags &
> > (WQ_MEM_RECLAIM | __WQ_LEGACY)) == WQ_MEM_RECLAIM),
> >
> > warning (instead of either adding __WQ_LEGACY | WQ_MEM_RECLAIM flags to the WQ used
> > by loop module or giving up WQ_MEM_RECLAIM flag for the WQ used by loop module),
> > correct?
>
> Yeah, you detected multiple issues at the same time. xfs sync is
> participating in memory reclaim
No it isn't. What makes you think it is part of memory reclaim?
The xfs-sync workqueue exists solely to perform async flushes of
dirty data at ENOSPC via sync_inodes_sb() because we can't call
sync_inodes_sb directly in the context that hit ENOSPC due to locks
and transaction contexts held. The paths that need this are
buffered writes and file create (on disk inode allocation), neither
of which are in the the memory reclaim path, either.
So this work has nothing to do with memory reclaim, and as such it's
not tagged with WQ_MEM_RECLAIM.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2022-03-22 22:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <e0a0bc94-e6de-b0e5-ee46-a76cd1570ea6@I-love.SAKURA.ne.jp>
[not found] ` <YjNHzyTFHjh9v6k4@dschatzberg-fedora-PC0Y6AEN.dhcp.thefacebook.com>
[not found] ` <5542ef88-dcc9-0db5-7f01-ad5779d9bc07@I-love.SAKURA.ne.jp>
[not found] ` <YjS+Jr6QudSKMSGy@slm.duckdns.org>
2022-03-19 2:02 ` [PATCH] loop: add WQ_MEM_RECLAIM flag to per device workqueue Tetsuo Handa
2022-03-21 16:55 ` Tejun Heo
2022-03-21 22:53 ` Tetsuo Handa
2022-03-21 23:04 ` Tejun Heo
2022-03-21 23:17 ` Tetsuo Handa
2022-03-21 23:27 ` Tejun Heo
2022-03-22 0:09 ` Tetsuo Handa
2022-03-22 16:52 ` Tejun Heo
2022-03-22 22:00 ` Dave Chinner [this message]
2022-03-22 22:02 ` Tejun Heo
2022-03-22 22:05 ` Tetsuo Handa
2022-03-22 22:19 ` Tejun Heo
2022-03-22 22:59 ` Dave Chinner
2022-03-22 23:32 ` Tetsuo Handa
2022-03-22 23:50 ` Dave Chinner
2022-03-23 0:09 ` Tejun Heo
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=20220322220007.GQ1544202@dread.disaster.area \
--to=david@fromorbit.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=schatzberg.dan@gmail.com \
--cc=tj@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