From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.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 0C61A37A829 for ; Tue, 21 Jul 2026 02:33:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784601202; cv=none; b=k+RL9B0AWOP1PlBLRwat6nCECM5j9ztSojvAuL2g/R56XmS3+WIItuHFRXolnPISAPMcleTszCEg4HtjZRhTXz+9K+Ih4LqD7h5SosCr6EUpZQAd0ftPUCgm0+6tu6kUDF3dV+ERcqIDVaJXujZLAyiIQkncEq5wz2IxFLQfSYs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784601202; c=relaxed/simple; bh=4nequTKog4janh5ttLwSx77eROAMWxxaZLcQli7ww9I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OCGMSWne+ctF0s29DYXsNQ1M1AuEl8wfejp+lf//WoJRkGM/dAPnHfjGOwJcuPhijzHj63Ix7uo70Tsu1jdYQAn8hwslfMOXTmjf8IrNOuUjxWyFR/pCJAAc78m1yB8AwvXxVXK9xP6sEC3Owx+UaQI0e31NBYc8nBvcwb7Reik= 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=moH6YXO3; arc=none smtp.client-ip=192.198.163.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="moH6YXO3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784601201; x=1816137201; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=4nequTKog4janh5ttLwSx77eROAMWxxaZLcQli7ww9I=; b=moH6YXO364JHXUP+fQEllJ5kLJqmor/uoVtsJfuaAwa5R/wRVo+n1srO a9HWJdf9EBLwGuD09z6K/4jCagN1WoJSKA/6GN1M1dpYyJGwbjxZhLPVQ o/PZzfohtktCVsdevzrxDthghfk1J3sMaK/GrdVor0F8K8TcyJFomgjxN BspEiMG8fTCsP90e/2k7GtPMRBR+AHirPMXpEjhRRPEa0oILf3Zkh5wiv glC1+qcKSr5IetZwCA4lHVH62cs6S9l5YaHcDGmJe/2uRWToOw4JO+jie VrkjmS1KKqnUHprh41WS1ILe2vk4/Emq/tsbJBo4aPiINinowdfOa0OWV g==; X-CSE-ConnectionGUID: jEeOa7LTSki+cxALCmSFMA== X-CSE-MsgGUID: +3CKtTL7RM2BuKOsfPyXqA== X-IronPort-AV: E=McAfee;i="6800,10657,11852"; a="95785684" X-IronPort-AV: E=Sophos;i="6.25,175,1779174000"; d="scan'208";a="95785684" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2026 19:33:18 -0700 X-CSE-ConnectionGUID: kaB3oi82RLCaF/p7eC5v1Q== X-CSE-MsgGUID: PT98EhOhS82Bxfz8714H+Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,175,1779174000"; d="scan'208";a="257682257" Received: from unknown (HELO [172.25.112.21]) ([172.25.112.21]) by orviesa007.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2026 19:33:17 -0700 From: Ricardo Neri Date: Mon, 20 Jul 2026 19:43:17 -0700 Subject: [PATCH v6 1/6] sched/fair: Do not skip CPUs of similar capacity with busy SMT siblings 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: <20260720-rneri-fix-cas-clusters-v6-1-bb500bf4afd4@linux.intel.com> References: <20260720-rneri-fix-cas-clusters-v6-0-bb500bf4afd4@linux.intel.com> In-Reply-To: <20260720-rneri-fix-cas-clusters-v6-0-bb500bf4afd4@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 , K Prateek Nayak , Andrea Righi , 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=1784601848; l=2418; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=4nequTKog4janh5ttLwSx77eROAMWxxaZLcQli7ww9I=; b=PsAh9oiJ9hlCiRcOfkOQhuss77b4IRzyhz3MzU1+U8PxYGj5gSXEeSTtwegBIoCXauWuUA5gj A6X+JDxkXIYASYAUIB4HV5rqqlwo3Wc8sGIp975gDNOjow3Bit83IJx X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= When picking a busiest CPU with only one running task, the function sched_balance_find_src_rq() skips candidate CPUs if the destination CPU has less than ~5% extra capacity. This condition only holds if all the SMT siblings of a CPU are idle. SMT siblings share the computing resources of a physical core and this results in reduced capacity if more than one sibling is busy. Skipping a CPU as described would prevent the load balancer from pulling tasks from a scheduling group previously and correctly identified as group_smt_balance (i.e., one with more than one task running). Do not skip a candidate CPU of similar capacity if it has busy SMT siblings. Reviewed-by: K Prateek Nayak Reviewed-by: Vincent Guittot Tested-by: Andrea Righi Signed-off-by: Ricardo Neri --- Changes in v6: * Added Tested-by tag from Andrea. Thanks! * Added Reviewed-by tag from Vincent. Thanks! Changes in v5: * Optimized logic to identify CPUs with busy SMT siblings only when needed. (Prateek, Chen Yu) * Added Reviewed-by tag from Prateek. Thanks! * Christian also provided his Reviewed-by tag, but the patch changed significantly since then. I did not think it was correct to keep it without him reviewing the updated patch first. Changes in v4: * Introduced this patch. Changes in v3: * N/A Changes in v2: * N/A --- kernel/sched/fair.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 37001c63452e..15a0e1ce90b7 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -13088,9 +13088,17 @@ static struct rq *sched_balance_find_src_rq(struct lb_env *env, * average load. */ if (env->sd->flags & SD_ASYM_CPUCAPACITY && - !capacity_greater(capacity_of(env->dst_cpu), capacity) && - nr_running == 1) - continue; + nr_running == 1) { + bool smt_degraded_cap = sched_smt_active() && !is_core_idle(i); + + /* + * Busy SMT siblings reduce the capacity of CPU @i. Do + * not skip it in this case. + */ + if (!smt_degraded_cap && + !capacity_greater(capacity_of(env->dst_cpu), capacity)) + continue; + } /* * Make sure we only pull tasks from a CPU of lower priority -- 2.43.0