From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: Omar Sandoval <osandov@osandov.com>,
linux-xfs@vger.kernel.org, kernel-team@fb.com,
Prashant Nema <pnema@fb.com>
Subject: Re: [PATCH v2 1/6] xfs: cache last bitmap block in realtime allocator
Date: Mon, 18 Sep 2023 08:38:48 -0700 [thread overview]
Message-ID: <20230918153848.GA348018@frogsfrogsfrogs> (raw)
In-Reply-To: <ZQN/qNgZJZdWdxQx@dread.disaster.area>
On Fri, Sep 15, 2023 at 07:48:24AM +1000, Dave Chinner wrote:
> On Fri, Sep 08, 2023 at 08:28:27AM -0700, Darrick J. Wong wrote:
> > On Fri, Sep 08, 2023 at 01:43:15PM +1000, Dave Chinner wrote:
> > > On Tue, Sep 05, 2023 at 02:51:52PM -0700, Omar Sandoval wrote:
> > > > From: Omar Sandoval <osandov@fb.com>
> > > >
> > > > Profiling a workload on a highly fragmented realtime device showed a ton
> > > > of CPU cycles being spent in xfs_trans_read_buf() called by
> > > > xfs_rtbuf_get(). Further tracing showed that much of that was repeated
> > > > calls to xfs_rtbuf_get() for the same block of the realtime bitmap.
> > > > These come from xfs_rtallocate_extent_block(): as it walks through
> > > > ranges of free bits in the bitmap, each call to xfs_rtcheck_range() and
> > > > xfs_rtfind_{forw,back}() gets the same bitmap block. If the bitmap block
> > > > is very fragmented, then this is _a lot_ of buffer lookups.
> > > >
> > > > The realtime allocator already passes around a cache of the last used
> > > > realtime summary block to avoid repeated reads (the parameters rbpp and
> > > > rsb). We can do the same for the realtime bitmap.
> > > >
> > > > This replaces rbpp and rsb with a struct xfs_rtbuf_cache, which caches
> > > > the most recently used block for both the realtime bitmap and summary.
> > > > xfs_rtbuf_get() now handles the caching instead of the callers, which
> > > > requires plumbing xfs_rtbuf_cache to more functions but also makes sure
> > > > we don't miss anything.
> > > >
> > > > Signed-off-by: Omar Sandoval <osandov@fb.com>
> > > > ---
> > > > fs/xfs/libxfs/xfs_rtbitmap.c | 179 ++++++++++++++++++-----------------
> > > > fs/xfs/xfs_rtalloc.c | 119 +++++++++++------------
> > > > fs/xfs/xfs_rtalloc.h | 30 ++++--
> > > > 3 files changed, 170 insertions(+), 158 deletions(-)
> > >
> > > ....
> > >
> > > > diff --git a/fs/xfs/xfs_rtalloc.h b/fs/xfs/xfs_rtalloc.h
> > > > index 62c7ad79cbb6..72f4261bb101 100644
> > > > --- a/fs/xfs/xfs_rtalloc.h
> > > > +++ b/fs/xfs/xfs_rtalloc.h
> > > > @@ -101,29 +101,40 @@ xfs_growfs_rt(
> > > > /*
> > > > * From xfs_rtbitmap.c
> > > > */
> > > > +struct xfs_rtbuf_cache {
> > > > + struct xfs_buf *bbuf; /* bitmap block buffer */
> > > > + xfs_fileoff_t bblock; /* bitmap block number */
> > > > + struct xfs_buf *sbuf; /* summary block buffer */
> > > > + xfs_fileoff_t sblock; /* summary block number */
> > >
> > > I don't think the block numbers are file offsets? Most of the code
> > > passes the bitmap and summary block numbers around as a
> > > xfs_fsblock_t...
> >
> > They're fed into xfs_bmapi_read as the xfs_fileoff_t parameter.
> >
> > I have a whole series cleaning up all of the units abuse in the rt code
> > part of the realtime modernization patchdeluge:
> > https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/log/?h=clean-up-realtime-units
> >
> > Here's the specific patch that cleans up this one part:
> > https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?h=realtime-groups&id=b344bd4bd655576f8bda193b0e33f471a6295b05
> ....
>
> > Could someone (Omar?) take a look at my other rt cleanups too? I'd very
> > much like to get them merged out of my dev tree.
>
> Can you post the series to the list? That makes it much easier to
> comment on them....
https://lore.kernel.org/linux-xfs/167243865605.709511.15650588946095003543.stgit@magnolia/
--D
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@fromorbit.com
next prev parent reply other threads:[~2023-09-18 16:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-05 21:51 [PATCH v2 0/6] xfs: CPU usage optimizations for realtime allocator Omar Sandoval
2023-09-05 21:51 ` [PATCH v2 1/6] xfs: cache last bitmap block in " Omar Sandoval
2023-09-08 3:43 ` Dave Chinner
2023-09-08 15:28 ` Darrick J. Wong
2023-09-14 21:48 ` Dave Chinner
2023-09-18 15:38 ` Darrick J. Wong [this message]
2023-10-09 10:34 ` Christoph Hellwig
2023-09-05 21:51 ` [PATCH v2 2/6] xfs: invert the realtime summary cache Omar Sandoval
2023-10-09 10:35 ` Christoph Hellwig
2023-09-05 21:51 ` [PATCH v2 3/6] xfs: return maximum free size from xfs_rtany_summary() Omar Sandoval
2023-10-09 10:35 ` Christoph Hellwig
2023-09-05 21:51 ` [PATCH v2 4/6] xfs: limit maxlen based on available space in xfs_rtallocate_extent_near() Omar Sandoval
2023-10-09 10:36 ` Christoph Hellwig
2023-09-05 21:51 ` [PATCH v2 5/6] xfs: don't try redundant allocations " Omar Sandoval
2023-10-09 10:38 ` Christoph Hellwig
2023-09-05 21:51 ` [PATCH v2 6/6] xfs: don't look for end of extent further than necessary " Omar Sandoval
2023-10-09 10:39 ` 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=20230918153848.GA348018@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=david@fromorbit.com \
--cc=kernel-team@fb.com \
--cc=linux-xfs@vger.kernel.org \
--cc=osandov@osandov.com \
--cc=pnema@fb.com \
/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.