All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: "hch@infradead.org" <hch@infradead.org>
Cc: Matthew Wilcox <willy@infradead.org>,
	Dave Chinner <david@fromorbit.com>,
	Trond Myklebust <trondmy@hammerspace.com>,
	"bfoster@redhat.com" <bfoster@redhat.com>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"trondmy@kernel.org" <trondmy@kernel.org>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] iomap: Address soft lockup in iomap_finish_ioend()
Date: Tue, 4 Jan 2022 11:22:27 -0800	[thread overview]
Message-ID: <20220104192227.GA398655@magnolia> (raw)
In-Reply-To: <YdSOgyvDnZadYpUP@infradead.org>

On Tue, Jan 04, 2022 at 10:14:27AM -0800, hch@infradead.org wrote:
> On Tue, Jan 04, 2022 at 06:08:24PM +0000, Matthew Wilcox wrote:
> > I think it's fine to put in a fix like this now that's readily
> > backportable.  For folios, I can't help but think we want a
> > restructuring to iterate per-extent first, then per-folio and finally
> > per-sector instead of the current model where we iterate per folio,
> > looking up the extent for each sector.
> 
> We don't look up the extent for each sector.  We look up the extent
> once and then add as much of it as we can to the bio until either the
> bio is full or the extent ends.  In the first case we then allocate
> a new bio and add it to the ioend.

Can we track the number of folios that have been bio_add_folio'd to the
iomap_ioend, and make iomap_can_add_to_ioend return false when the
number of folios reaches some threshold?  I think that would solve the
problem of overly large ioends while not splitting folios across ioends
unnecessarily.

As for where to put a cond_resched() call, I think we'd need to change
iomap_ioend_can_merge to avoid merging two ioends if their folio count
exceeds the same(?) threshold, and then one could put the cond_resched
after each iomap_finish_ioend call in iomap_finish_ioends, and declare
that iomap_finish_ioends cannot be called from atomic context.

I forget if anyone ever benchmarked the actual overhead of cond_resched,
but if my dim memory serves, it's not cheap but also not expensive.

Limiting each ioend to (say) 16k folios and not letting small ioends
merge into something bigger than that for the completion seems (to me
anyway) a balance between stalling out on marking pages after huge IOs
vs. losing the ability to coalesce xfs_end_ioend calls when a contiguous
range of file range has been written back but the backing isn't.

<shrug> That's just my ENOCOFFEE reaction, hopefully that wasn't total
nonsense.

--D

> > Particularly for the kind of case Trond is talking about here; when we
> > want to fsync(), as long as the entire folio is Uptodate, we want to
> > write the entire thing back.  Doing it in portions and merging them back
> > together seems like a lot of wasted effort.
> 
> Writing everything together should be the common case.

  reply	other threads:[~2022-01-04 19:22 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-30 19:35 [PATCH] iomap: Address soft lockup in iomap_finish_ioend() trondmy
2021-12-30 21:24 ` Jens Axboe
2021-12-30 22:25   ` Trond Myklebust
2021-12-30 22:27     ` Jens Axboe
2021-12-30 22:55       ` Trond Myklebust
2021-12-31  1:42 ` Matthew Wilcox
2021-12-31  6:16   ` Trond Myklebust
2022-01-01  3:55     ` Dave Chinner
2022-01-01 17:39       ` Trond Myklebust
2022-01-03 22:03         ` Dave Chinner
2022-01-04  0:04           ` Trond Myklebust
2022-01-04  1:22             ` Dave Chinner
2022-01-04  3:01               ` Trond Myklebust
2022-01-04  7:08               ` hch
2022-01-04 18:08                 ` Matthew Wilcox
2022-01-04 18:14                   ` hch
2022-01-04 19:22                     ` Darrick J. Wong [this message]
2022-01-04 21:52                       ` Dave Chinner
2022-01-04 23:12                         ` Darrick J. Wong
2022-01-05  2:10                           ` Dave Chinner
2022-01-05 13:56                             ` Brian Foster
2022-01-05 22:04                               ` Dave Chinner
2022-01-06 16:44                                 ` Brian Foster
2022-01-10  8:18                                   ` Dave Chinner
2022-01-10 17:45                                     ` Brian Foster
2022-01-10 18:11                                       ` hch
2022-01-11 14:33                                       ` Trond Myklebust
2022-01-05 13:42                           ` hch
2022-01-04 21:16                 ` Dave Chinner
2022-01-05 13:43                   ` hch
2022-01-05 22:34                     ` Dave Chinner
2022-01-05  2:09               ` Trond Myklebust
2022-01-05 20:45                 ` Trond Myklebust
2022-01-05 22:48                   ` Dave Chinner
2022-01-05 23:29                     ` Trond Myklebust
2022-01-06  0:01                     ` Darrick J. Wong
2022-01-09 23:09                       ` Dave Chinner
2022-01-06 18:36                     ` Trond Myklebust
2022-01-06 18:38                       ` Trond Myklebust
2022-01-06 20:07                       ` Brian Foster
2022-01-07  3:08                         ` Trond Myklebust
2022-01-07 15:15                           ` Brian Foster
2022-01-09 23:34                       ` Dave Chinner
2022-01-10 23:37                       ` Dave Chinner
2022-01-11  0:08                         ` Dave Chinner
2022-01-13 17:01                         ` Trond Myklebust
2022-01-17 17:24                           ` Trond Myklebust
2022-01-17 17:36                             ` Darrick J. Wong
2022-01-04 13:36         ` Brian Foster
2022-01-04 19:23           ` Darrick J. Wong
2022-01-05  2:31 ` [iomap] f5934dda54: BUG:sleeping_function_called_from_invalid_context_at_fs/iomap/buffered-io.c kernel test robot
2022-01-05  2:31   ` kernel test robot

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=20220104192227.GA398655@magnolia \
    --to=djwong@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=trondmy@hammerspace.com \
    --cc=trondmy@kernel.org \
    --cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.