mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Carlos Maiolino <cem@kernel.org>
To: Rik van Riel <riel@surriel.com>
Cc: linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org,
	 "Darrick J. Wong" <djwong@kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	kernel-team@meta.com,  Christian Andres Saide <csaide@meta.com>
Subject: Re: [PATCH] xfs: keep successful near rt allocations
Date: Wed, 4 Nov 2026 16:45:58 +0100	[thread overview]
Message-ID: <autTB937zQMYxbBb@nidhogg.toxiclabs.cc> (raw)
In-Reply-To: <20261104100115.36bf7d28@fangorn>

On Wed, Nov 04, 2026 at 10:01:15AM -0500, Rik van Riel wrote:
> XFS realtime allocations first attempt to allocate space near where
> other parts of a file already are. If that allocation succeeds, it
> does not have to do a global search for free space.
> 
> Unfortunately, a code cleanup a while ago causes xfs_rtallocate_rtg
> to unconditionally do the global search, even when the search for a
> nearby extent has succeeded.
> 
> Fix it by running the global search only when the near search did
> not find available space.
> 
> Found by noticing higher kernel CPU use and examining the profile.
> 
> Fixes: fd048a1bb391d ("xfs: rework the rtalloc fallback handling")
> Cc: stable@vger.kernel.org # v6.12
> Reported-by: Christian Andres Saide <csaide@meta.com>
> Signed-off-by: Rik van Riel <riel@surriel.com>

This sounds correct yes.

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>


> ---
>  fs/xfs/xfs_rtalloc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
> index 84efe5a8fb11..31d90828b4e9 100644
> --- a/fs/xfs/xfs_rtalloc.c
> +++ b/fs/xfs/xfs_rtalloc.c
> @@ -1997,10 +1997,14 @@ xfs_rtallocate_rtg(
>  		if (error == -ENOSPC) {
>  			xfs_rtbuf_cache_relse(&args);
>  			error = 0;
> +			start = 0;
>  		}
>  	}
>  
> -	if (!error) {
> +	/*
> +	 * Global search, runs when the near search did not find space.
> +	 */
> +	if (!error && !start) {
>  		error = xfs_rtallocate_extent_size(&args, minlen, maxlen, &len,
>  				prod, &rtx);
>  	}
> -- 
> 2.56.0
> 
> 

  reply	other threads:[~2026-11-04 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 15:01 Rik van Riel
2026-11-04 15:45 ` Carlos Maiolino [this message]
2026-11-05  7:52 ` Christoph Hellwig
2026-11-09  8:04 ` Carlos Maiolino

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=autTB937zQMYxbBb@nidhogg.toxiclabs.cc \
    --to=cem@kernel.org \
    --cc=csaide@meta.com \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=riel@surriel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®