From: Omar Sandoval <osandov@osandov.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org, kernel-team@fb.com,
Prashant Nema <pnema@fb.com>
Subject: Re: [PATCH 4/6] xfs: limit maxlen based on available space in xfs_rtallocate_extent_near()
Date: Mon, 17 Jul 2023 13:33:39 -0700 [thread overview]
Message-ID: <ZLWlo46WoX/FDZPL@telecaster> (raw)
In-Reply-To: <20230712230159.GX108251@frogsfrogsfrogs>
On Wed, Jul 12, 2023 at 04:01:59PM -0700, Darrick J. Wong wrote:
> On Tue, Jun 20, 2023 at 02:32:14PM -0700, Omar Sandoval wrote:
> > From: Omar Sandoval <osandov@fb.com>
> >
> > xfs_rtallocate_extent_near() calls xfs_rtallocate_extent_block() with
> > the minlen and maxlen that were passed to it.
> > xfs_rtallocate_extent_block() then scans the bitmap block looking for a
> > free range of size maxlen. If there is none, it has to scan the whole
> > bitmap block before returning the largest range of at least size minlen.
> > For a fragmented realtime device and a large allocation request, it's
> > almost certain that this will have to search the whole bitmap block,
> > leading to high CPU usage.
> >
> > However, the realtime summary tells us the maximum size available in the
> > bitmap block. We can limit the search in xfs_rtallocate_extent_block()
> > to that size and often stop before scanning the whole bitmap block.
> >
> > Signed-off-by: Omar Sandoval <osandov@fb.com>
> > ---
> > fs/xfs/xfs_rtalloc.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
> > index ba7d42e0090f..d079dfb77c73 100644
> > --- a/fs/xfs/xfs_rtalloc.c
> > +++ b/fs/xfs/xfs_rtalloc.c
> > @@ -488,6 +488,8 @@ xfs_rtallocate_extent_near(
> > * allocating one.
> > */
> > if (maxlog >= 0) {
> > + xfs_extlen_t maxavail =
> > + min(maxlen, ((xfs_extlen_t)1 << (maxlog + 1)) - 1);
>
> There can be up to 2^52rtx (realtime extents) in the filesystem, right?
> xfs_extlen_t is a u32, which will overflow this calculation if the
> realtime volume is seriously huge. IOWs, doesn't this need to be:
>
> xfs_extlen_t maxavail = max_t(xfs_rtblock_t, maxlen,
> (1ULL << (maxlog + 1)) - 1);
>
> (The rest of the patch looks ok)
min_t instead of max_t, but good catch, fixed.
next prev parent reply other threads:[~2023-07-17 20:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 21:32 [PATCH 0/6] xfs: CPU usage optimizations for realtime allocator Omar Sandoval
2023-06-20 21:32 ` [PATCH 1/6] xfs: cache last bitmap block in " Omar Sandoval
2023-07-12 18:29 ` Darrick J. Wong
2023-07-17 18:18 ` Omar Sandoval
2023-08-01 22:48 ` Darrick J. Wong
2023-06-20 21:32 ` [PATCH 2/6] xfs: invert the realtime summary cache Omar Sandoval
2023-07-12 22:40 ` Darrick J. Wong
2023-07-17 19:54 ` Omar Sandoval
2023-08-01 23:17 ` Darrick J. Wong
2023-06-20 21:32 ` [PATCH 3/6] xfs: return maximum free size from xfs_rtany_summary() Omar Sandoval
2023-07-12 22:44 ` Darrick J. Wong
2023-06-20 21:32 ` [PATCH 4/6] xfs: limit maxlen based on available space in xfs_rtallocate_extent_near() Omar Sandoval
2023-07-12 23:01 ` Darrick J. Wong
2023-07-17 20:33 ` Omar Sandoval [this message]
2023-06-20 21:32 ` [PATCH 5/6] xfs: don't try redundant allocations " Omar Sandoval
2023-07-12 23:34 ` Darrick J. Wong
2023-07-17 21:06 ` Omar Sandoval
2023-07-31 20:58 ` Omar Sandoval
2023-08-01 23:00 ` Darrick J. Wong
2023-06-20 21:32 ` [PATCH 6/6] xfs: don't look for end of extent further than necessary " Omar Sandoval
2023-08-01 23:40 ` Darrick J. Wong
2023-07-06 21:39 ` [PATCH 0/6] xfs: CPU usage optimizations for realtime allocator Omar Sandoval
2023-07-07 0:36 ` Dave Chinner
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=ZLWlo46WoX/FDZPL@telecaster \
--to=osandov@osandov.com \
--cc=djwong@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-xfs@vger.kernel.org \
--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.