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=1796382750; b=LTaVVPsOfPrgmoXTjfPuxFMWG4tqhPQGX/3HU55GWpGetVIiAlBn6lW/vUNzdl5k7+hb 35Co0C5LMF7JNcX079264ZZ3DmAkHm1H8b2IUhMraOUB/yZEv8fFL3oiwRYKKW1tWLMDt T5tiXAWIlWWXDBAFn+6Cp2nGiP/nJPINTFb53xoQnzQuXAqvIIYC3K7tjJlbhkc+0eFOZ 0Du6rSFcL/TXEmrhKUEgl3dv81qsDUWjBXmHa9NwBeXyh94SDWad7ExAmvSyTlv4gTauf zhwTnz5VTvuYl5A9haL0hlN6sgb8V2hqXNphAVhAJYNqmZkAH5w/AEUcX/q0fTc3gKQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382750; 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=kKTZhCIC3YlleHsaqqGLZD4SIjWb9czMOY8TYqctCYQ=; b=ZxMKI1/WCR+yU1cxzkCdsluyTa7EYN+N7cR6CUngVFjSbvcn+AH2uqpP/Zc8ZfMFr84f z8NtgfMmuz+KIC8YVSjFP4XF/WHN3PPw1iEfOh9+VqKRCDo60evfpvaY/cjcDAiKZ6czB AbQwMghOPeq206Grj4kgT/TyPhYPuj7PIJ2b3V1wSwKydUEf97VjNXKsmqiSQwK3KcUxf 6dZPjPiZlCzKdE6V/28jHIWJTFM2fufsCZVH5eDuvqOxr8339vkIVa9+Ga59/tbNKWwdV o/Cf8uc8Bd4Vrf8PxNqfH0biWmBc0BJ3PHPixX7N5yL0mNGr5U6tt+awEELA7sM1ZUw== 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=TESyR1ro; 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 4C211606A336; Fri, 4 Dec 2026 11:12:30 +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=TESyR1ro Received: by smtp.kernel.org (Postfix) with ESMTPSA id B06461F0093B; Fri, 4 Dec 2026 11:12:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382750; bh=kKTZhCIC3YlleHsaqqGLZD4SIjWb9czMOY8TYqctCYQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TESyR1rofRznlvK4etgrgZrT4LdSHNjFiBg51lvnj0eXiqTikezMzvBfzcrA5uAc/ CGYY/bQiJJmI3QOegkCJHMup5Zmnwm6xNVQBjn86f6tO3VO+MqBrYr19vfFvhzO0Eo YMSoyIAeNdirNL/6oCNGcDDBzJ1iXDD5e9uvFfo0= 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.18 547/703] xfs: keep successful near rt allocations Date: Fri, 4 Dec 2026 19:07:26 +0900 Message-ID: <20261204100642.329151412@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-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 @@ -1959,10 +1959,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); }