Re: [PATCH 2/4] xfs: Introduce writeback context for writepages

Christoph Hellwig
2015-09-01T07:41:07Z

On Tue, Sep 01, 2015 at 08:17:43AM +1000, Dave Chinner wrote:
> The patch changes the bio allocation patterns - it allocates them on
> the fly and holds them, so we could potentially exhaust the bio
> mempool with this submission technique.

I've spend time to look over the patch again, and still don't see
a change. Both in the old and new code we walk over the ioends
and build bios on the fly in xfs_submit_ioend(), which is always
called near then end of the writeback code; at the end of
xfs_vm_writepage in the old version, and from the end of
xfs_vm_writepage/xfs_vm_writepages through xfs_writepage_submit in
the new code (not taking the error case into account, which probably
should moe there, too).

The only big difference is..

> The ioend allocation pattern
> is different, too, because we only used to have 1 per buffer on a
> writepage call and the last one was used for the write clustering.

.. that we now build up way bigger ioend chains.

So back to Brians concern: we can now have fairly large piles of
ioends built up while potentially getting scheduled out, and this
does look like a potential real issue to me. I wonder if we should
(ab-)use the blk_plug_cb infrastructure so that we can flush the
pending ioends out on a context switch?