From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381340; b=rkyDLMXkSGRhuNr1aaPIaiZQdmZhmWKZnkyZtZ7reMfHhkBIme7oFmOLNA78SBfbmk01 Luy/LI5rKG0RvA1XjJnGJG/TMSr+25CGHwVNehoLpi+sW831r3SGrrRsZiZh+SbjsB70Q E+rrhjzrbO9hfD4Jjn77eRWUS06wBmvgfSEvjdBC92P5fGaqwIwID84ctX98GUW7UrR8e ijSToaUMoIRUCK41EvtmQNkUWxbctL7qNpWrwd4DtNPJhNp6ZMi4dC/mWezAGpbWRIpnJ WfW7STpE3LgBatkNW5WrNPCEXcQKYnUUDldd22MVMeWn0q+WsGsd/Rlorwvaham+BWQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381340; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=w9LxpyzD6ZDhU7KHuCrMuCD2fEfBiF95Cw/uwDWfClU=; b=sbs7YxqJ+qq0oFtyBcKg/qi4WDyS2iHnm2sFjfYOwKNWqefgcx37L+RcnwnIJA9NwqoK mTGdNBtTRdVaZqv9uJmd6lgoD/n/GXsmA2fL8UYWKApUqUm8KuyxpMrJP5gw9lJXjgIgR 7eAzsJOYSCsfEkbqADIxhq7V/tnjrfDEzTwbgLcwR/4v3O+N6c8me2M3DUVBgThx3OSSb eq2wqT6MzkECWmZlFnl31gIcr39Y1as3RYYndQog02nKW+ieGiHhgxFtAiWP7NnghJt74 qxNtb2/iC5ADH37pA61wKVyT8O9CMYlmeGa9Pd3KBOm6nbQMHKAyJae8MPKPHNaq17A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=cgPXSLvW; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6029606A32C; Fri, 4 Dec 2026 10:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=cgPXSLvW Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBDF31F000CE; Fri, 4 Dec 2026 10:48:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381340; bh=w9LxpyzD6ZDhU7KHuCrMuCD2fEfBiF95Cw/uwDWfClU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cgPXSLvWflmj3g4bZudgQBN4yO8ybNLue6WYJvwwlZP69byp4b0bsma4E5zYHsyyw yBJD5Scr4hhku8TDZx2MXkQV4B3ikwTGSS8Qe7qh3LaRpebiKwrxhR/fCDBv4c38Eq EMOki+tnHCBxbYklrW1B6lKzOnK78jF+WnvjXFoI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christian Andres Saide , Rik van Riel , Christoph Hellwig , Carlos Maiolino , Carlos Maiolino Subject: [PATCH 7.3 620/742] xfs: keep successful near rt allocations Date: Fri, 4 Dec 2026 19:08:04 +0900 Message-ID: <20261204100651.578214436@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rik van Riel commit f9bfe5af596a5ef6fc745c30bda41f9a109ed16d upstream. 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 Signed-off-by: Rik van Riel Reviewed-by: Christoph Hellwig Reviewed-by: Carlos Maiolino Signed-off-by: Carlos Maiolino Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_rtalloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- 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); }