From nobody Wed Sep 30 12:52:44 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75EEA3BD63D; Sat, 8 Aug 2026 09:44:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786182300; cv=none; b=ZaArB3lqscMawCj7BXTprYdMTKcsjGxfn4Nl5W6Mi8FFNAOkZlYlc/IN7xhokrJOjo+NWtj+rOvb8XmYhfwZ639U7EuwrkncB6374gnbOeCODOsKmtHmVY1QI6Ea6JKmQ8+8HKx6DQwY94Nkn/vUt19V09KTEEux/lx3Zdv3V5U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786182300; c=relaxed/simple; bh=hG5OOXoY4APtJ9IGpRwHcnWSPtnCsu8Z3SIRtG+nsCU=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=VeotsDgu5SKXjbUSCzmSadZq3pVRYCzTV3/Ttc2DPh2M+qpT7h8PdenbniBAL62w8c3iNwFP1QOtLQ2pDVXjJrnkHGVhPl2G1fOdxaeGkWK0sF7Dl9hirBO+G6dLbWwefoLsxjLfvRkV1OjuV0+EsCSdDe66O6VPiqSfThJwn+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0VNjruJW; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=9Zss9uvA; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0VNjruJW"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="9Zss9uvA" Date: Sat, 08 Aug 2026 09:44:49 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786182291; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TmIBxrja8b/qAK8Y2XJGVDXsYEoZDQbfgQtcJ0KJhpc=; b=0VNjruJWCXVDupW3t3HccQm2jfKGNcm/cr1wp81bJlGsB518y+fJF28f9i6RkqXYJKEYlk 4zyfbbJKHb7lEe2ABZGojFfNJ9124L8DNAPeaVQ99hoXlt8gT+lVqvwG0Eh/UfFCZl3oiS myAUrNSwVhUK8iXMRWJiMQwPmCkos97fOh9Pw63eU8GhNPumdV2XXNkt0ebjs5ESVISZdj fdFitOGHMpW9JGVV8LAKnuCYeYN+oO13pshAbHJgJg304NY6Xh0T/cn0idk1dv9uQ4csf4 SBZIjnPXpd0g5uR6y2Jcc1K/AKa2kl8h0R/qAsLEMQygKY5Mt75SYjSBZr+Ong== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786182291; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TmIBxrja8b/qAK8Y2XJGVDXsYEoZDQbfgQtcJ0KJhpc=; b=9Zss9uvAtjkmQ/CMawxDBaiwZbVlMRxXf4dCuazccXMtMkqJXzyZ3gZkTq59emHZjlQi3J K2zc9ii5t/pjHwCg== From: "tip-bot2 for Ricardo Neri" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Check CPU capacity before comparing group types during load balance Cc: Ricardo Neri , "Peter Zijlstra (Intel)" , Christian Loehle , Chen Yu , Tim Chen , Vincent Guittot , Andrea Righi , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260720-rneri-fix-cas-clusters-v6-3-bb500bf4afd4@linux.intel.com> References: <20260720-rneri-fix-cas-clusters-v6-3-bb500bf4afd4@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178618228992.442315.2997423009516891608.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the sched/core branch of tip: Commit-ID: 50b101f6e586b4417d060a976fd831cd87e86e2b Gitweb: https://git.kernel.org/tip/50b101f6e586b4417d060a976fd831cd8= 7e86e2b Author: Ricardo Neri AuthorDate: Mon, 20 Jul 2026 19:43:19 -07:00 Committer: Peter Zijlstra CommitterDate: Fri, 07 Aug 2026 18:27:10 +02:00 sched/fair: Check CPU capacity before comparing group types during load bal= ance update_sd_pick_busiest() may incorrectly select a fully_busy group as the busiest group when its per-CPU capacity exceeds that of the destination CPU. This happens because the type of busiest group is initialized to group_has_spare and allows the fully_busy group to win the type comparison. update_sd_pick_busiest() should not choose a candidate scheduling group with at most one runnable task if its per-CPU capacity is greater than that of the destination CPU. Such a check already exists, but it is done too late: after the type comparison, preventing a subsequent fully_busy group of equal per-CPU capacity from being correctly selected. Move this check to occur before comparing group types. Fixes: 0b0695f2b34a ("sched/fair: Rework load_balance()") Signed-off-by: Ricardo Neri Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Christian Loehle Reviewed-by: Chen Yu Reviewed-by: Tim Chen Reviewed-by: Vincent Guittot Tested-by: Christian Loehle Tested-by: Andrea Righi Link: https://patch.msgid.link/20260720-rneri-fix-cas-clusters-v6-3-bb500bf= 4afd4@linux.intel.com --- kernel/sched/fair.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 2c5cfec..f9d0edd 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -12054,6 +12054,17 @@ static bool update_sd_pick_busiest(struct lb_env *= env, sds->local_stat.group_type !=3D group_has_spare)) return false; =20 + /* + * Candidate sg has no more than one task per CPU and has higher + * per-CPU capacity. Migrating tasks to less capable CPUs may harm + * throughput. Maximize throughput, power/energy consequences are not + * considered. + */ + if ((env->sd->flags & SD_ASYM_CPUCAPACITY) && + (sgs->group_type <=3D group_fully_busy) && + (capacity_greater(sg->sgc->min_capacity, capacity_of(env->dst_cpu)))) + return false; + if (sgs->group_type > busiest->group_type) return true; =20 @@ -12160,17 +12171,6 @@ has_spare: break; } =20 - /* - * Candidate sg has no more than one task per CPU and has higher - * per-CPU capacity. Migrating tasks to less capable CPUs may harm - * throughput. Maximize throughput, power/energy consequences are not - * considered. - */ - if ((env->sd->flags & SD_ASYM_CPUCAPACITY) && - (sgs->group_type <=3D group_fully_busy) && - (capacity_greater(sg->sgc->min_capacity, capacity_of(env->dst_cpu)))) - return false; - return true; } =20