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=1796384123; b=KZxY2RPVtROCEIksVk90MeH3dllogtE11UZKofn6mqXpw89ScqpRO5wpOTxI8CK2om/R xGj7faKyjNvKMtl9o9LRqC2+a5Qn9igbPfl/ysqyU3pt+m86DbmDdosFLuvzwkZ1RUQU7 Uz8soin1bt9Nv29+U0/9sAIs137o+TioT7B7LMrF/WLjvx5IB/ohLiOyfrqIG0eUKa0Hy S7JteHgmQJrzyHptbdekgwM+ox7XMT1GIeirJWXRbskjcOIbbkLw2FOjQbpqo3VneX3yS ujEGFNw0lFo7U5GtJ/Fu6iEJPfkr11jFac06nimq8/dMjopntryVHtgWwWOrF4ck3Hw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384123; 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=Pxujpq0f+aOUlD2egNJOh3sbPQ+ATP9u06RDbWrszaA=; b=zKhS7sKg/FWOIeg/gGuTrJPLPH1PKqKkCvEveS5wbkYhgeqezXxokddKqWGrT3vhfzqt rkqx/dweK3jrI15L2kdDpopa3Gq4oP7O7INHRmyZ0H1ZkLb12xafcmgK5Ezk+EmNlZKOy zbS/djxDxyB8eDxr/MFhZAx3pwxsc+FKC5peKWd+Az4oBa4SwFCCAMHMFhiLp5FmkThZT /LjoCZvjpg3d6EPg/Lh/IMgLGqJf9aWmIfL4NHQDPpguWEiR3r+gZTbzY+CmmwjjuR7ux VQXwxi4ANsMZMCigwUQO7SnQ5niB398aoGvVXL6kPg0b/ak7mz+Vq9Bf09BaG8xMYzA== 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=qXtnTePD; 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 A09C0606A322; Fri, 4 Dec 2026 11:35:23 +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=qXtnTePD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14EB41F000C2; Fri, 4 Dec 2026 11:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384123; bh=Pxujpq0f+aOUlD2egNJOh3sbPQ+ATP9u06RDbWrszaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qXtnTePDrVYwTkMje4RMTjBYpl/4dvVbOartk5fq37/Ju7NP8VyXd3ABk+rKZfUOw pTUJhr2/ZbSrjETqmAr+asYBul1AHnHbz1MU1mlAr8Dyh2/puTFU8m2GV7CzYZ3cq/ ojv6N9hC9CXgaxCYdBDKOxdEp8CuRqAz05oakGCs= 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 6.12 465/555] xfs: keep successful near rt allocations Date: Fri, 4 Dec 2026 19:08:28 +0900 Message-ID: <20261204100627.044923554@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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 6.12-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 @@ -1310,10 +1310,14 @@ xfs_rtallocate( 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); }