From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 6658E3B0AC4 for ; Wed, 29 Apr 2026 21:21:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777497710; cv=none; b=sbs3dmlsaTu1ud0GFiVqOY2p1oo+z683r++IShZCPqAmgGn/T4u+z1ObaLu9bYAVeDERSKnbSbXVz/0Dk22mKGbsK9td1b4wd6c+enEoZydscNI2A7J9OrRAvx5vsuorQz+S8BM73+si3ysUUMQs9ZAH9VMlBZUZhLHRTKUDl+8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777497710; c=relaxed/simple; bh=3N8DdPsZ0XnP6ME8/dycbVhxXqjJ98aGEwzqEAPebNs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FN5ztCMk4QG6vBXJzDwZa1AOAw1upCWYP/dBvgYWTbh5OIhDyuxG0+YYqhs75RMD4IAtwSnnuYJzQ5vlp6zCTc842FWJCcBU9iTKDb/orXq4PrI3mDfiTjmahmWu0eTDac9xc/nxlvalsZ11NX+nUf9ebZ3EQSD/PfLdv2ph5DM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KywlqMkJ; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KywlqMkJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777497709; x=1809033709; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=3N8DdPsZ0XnP6ME8/dycbVhxXqjJ98aGEwzqEAPebNs=; b=KywlqMkJok2EcO2y5Buhg1cpmCWhN3uaS4DoNvzeUDExch0Px73ZPsuD A69G7agoN3gdRIxwqGKd5sZDs7ZW4t9GkbsUY8MjlQRdm3oX1Lh2tGxw5 gAzZw1LJRD/Ghj45bCbatSoGmQF5RjoaQAFtIIPbncXHVmhSdzAK6hEb2 KHkGhlzWrJNFLCMp5YXMXgOWoYXv9b2JKJWJ7zs1BlTHfwePM7QtLmhS7 fJUQ7K3y8vtSSrYGjK64t3c8ZCnC9ACaVlB42smxVgClhhYwSc+Hq8sTh KCCgmLGRk1oOTnWpR7RTqEq2TiUA2ZXP2Qap8tPTAuCIMoTvhQUajVGTh g==; X-CSE-ConnectionGUID: PiTjJQ54Scy9+RIZPRnkQQ== X-CSE-MsgGUID: pMwiyj+9R1WtWdA8JGqT1A== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="88748752" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="88748752" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 14:21:45 -0700 X-CSE-ConnectionGUID: U9d91G/EQryT8PoiFlYiCA== X-CSE-MsgGUID: bW4+Ws/cT/es3/xrzMCJmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="234260035" Received: from unknown (HELO [172.25.112.21]) ([172.25.112.21]) by orviesa008.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 14:21:45 -0700 From: Ricardo Neri Date: Wed, 29 Apr 2026 14:19:46 -0700 Subject: [PATCH v2 3/4] sched/fair: Allow load balancing between CPUs of identical capacity Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260429-rneri-fix-cas-clusters-v2-3-cd787de35cc6@linux.intel.com> References: <20260429-rneri-fix-cas-clusters-v2-0-cd787de35cc6@linux.intel.com> In-Reply-To: <20260429-rneri-fix-cas-clusters-v2-0-cd787de35cc6@linux.intel.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Tim C Chen , Chen Yu , Christian Loehle , Barry Song Cc: "Rafael J. Wysocki" , Len Brown , ricardo.neri@intel.com, linux-kernel@vger.kernel.org, Ricardo Neri X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1777497633; l=1972; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=3N8DdPsZ0XnP6ME8/dycbVhxXqjJ98aGEwzqEAPebNs=; b=C5+xVatnVOe2mB6h09hIWx9VD/qnY/kGyLRr1u9HOdkcd7jLQCIx8oLt0w5hCFhlE8FUd9neB Bk7cdmnCsjlCKNQG5O1nhoVig+B1Q3gPktnzOqANtZziq+icz+Lvf/w X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= sched_balance_find_src_rq() avoids selecting a runqueue with a single running task as busiest if doing so results in migrating the task to a CPU with less than ~5% of extra capacity. It also unintentionally prevents migrations between CPUs of identical capacity. When CONFIG_SCHED_CLUSTER is enabled, load should be balanced across clusters of CPUs with the same capacity. Allowing migration between CPUs of identical capacity is necessary to meet this goal. We are interested in the architectural capacity of the involved CPUs, excluding any reductions due to side activity or thermal pressure. Use arch_scale_cpu_capacity(). While here, invert the check for runtime capacity for clarity. Signed-off-by: Ricardo Neri --- Changes since v1: * Used arch_scale_cpu_capacity() instead of capacity_of() to ignore runtime variability. * Inverted the check for runtime capacity. (Christian) * Reworded patch description for clarity. --- kernel/sched/fair.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 166a5b109e0e..4105717e64fe 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11816,9 +11816,14 @@ static struct rq *sched_balance_find_src_rq(struct lb_env *env, * eventually lead to active_balancing high->low capacity. * Higher per-CPU capacity is considered better than balancing * average load. + * + * Cluster scheduling requires balancing load across clusters + * of identical capacity. Use architectural capacity to ignore + * runtime variability. */ if (env->sd->flags & SD_ASYM_CPUCAPACITY && - !capacity_greater(capacity_of(env->dst_cpu), capacity) && + arch_scale_cpu_capacity(env->dst_cpu) != arch_scale_cpu_capacity(i) && + capacity_greater(capacity, capacity_of(env->dst_cpu)) && nr_running == 1) continue; -- 2.43.0