From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 A4FB4257854 for ; Mon, 8 Jun 2026 12:47:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780922838; cv=none; b=NXb2xXJp/qkoodfWsQe2UN98HHqucPGXIzFtl2jBr0O/0BXud4i/bM8mLeGrxXTrxAbJn4j0wqSqRIeTPYKueFJyxpC+By3h78K8IKGqr8piO4l6L74zSgEuscz93uWrWsTbPZFxNoFO5ITHlzkw5dHkGFjX8oixOxRiUcILguQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780922838; c=relaxed/simple; bh=+4y2doS053fUI1M8ulzJ7xzX8CgHG125nPm549o2bN8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KgmMzIwz3Qgnk1NyW4ij+JQXFRepDRZvE/r83DkIKJ7gtf6TQ3TedntHah87pgtUzSFq2kkPqfkqDYKrXBTFVoi36+XrFpRK0wXj6n/yvHaFkq9Qb7Jxyc3KQZdAUSJpblPThCLE+snmwy74Z3Vkoklbyy0M651W24ON752hABk= 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=b+tnhxNj; arc=none smtp.client-ip=198.175.65.15 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="b+tnhxNj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1780922838; x=1812458838; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=+4y2doS053fUI1M8ulzJ7xzX8CgHG125nPm549o2bN8=; b=b+tnhxNjzIsG2w5Jxs1++V07py+SbC7kEk3oiu7Pz+Nna15xs0hgRT9Z VIof39eFZfKbgSoUf+CKJr7hhuwqPoxqW9pxkDoZ6Pf6tJSlIb5/5dyJt JlAIi+khbi5w8ArtcY/pif5X56xul9OQTatKVMuvPrOl/3jKippEL4zg3 RjrCj+yJdGpN7qKD582RS6E76LbpJSQ9JWtF7Qk3ZNcJNfsadW/+LuwsS CBGojpxXin/41UnVjrZDyXeRrGPAQ54s3Rjlxp2cYJfey+i/twhyzdAcR 4AA/vLxJCJwv9gaO+ZFpaNxH3VwNMjFcPzu32O3z05HCARV6sSu36g3W1 Q==; X-CSE-ConnectionGUID: m15jeJNlS3mBf84NrkKAcg== X-CSE-MsgGUID: M3MBRz95SRi+CGAxQXEs/A== X-IronPort-AV: E=McAfee;i="6800,10657,11810"; a="85281903" X-IronPort-AV: E=Sophos;i="6.24,194,1774335600"; d="scan'208";a="85281903" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2026 05:47:15 -0700 X-CSE-ConnectionGUID: 5p9A393+Sbqpo9H7R8UbHQ== X-CSE-MsgGUID: oNLcd8DxQ4el7midFi3thw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,194,1774335600"; d="scan'208";a="247409304" Received: from unknown (HELO [172.25.112.21]) ([172.25.112.21]) by fmviesa004.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2026 05:47:14 -0700 From: Ricardo Neri Date: Mon, 08 Jun 2026 05:57:11 -0700 Subject: [PATCH v4 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: <20260608-rneri-fix-cas-clusters-v4-1-1526711c944c@linux.intel.com> References: <20260608-rneri-fix-cas-clusters-v4-0-1526711c944c@linux.intel.com> In-Reply-To: <20260608-rneri-fix-cas-clusters-v4-0-1526711c944c@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" , Andrea Righi , K Prateek Nayak , 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=1780923493; l=1937; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=+4y2doS053fUI1M8ulzJ7xzX8CgHG125nPm549o2bN8=; b=12cjhSL8nxZi+taxwpAHAHrRd8e/y0X1e3woJQLzUwm9llZqEIZXCRVO2FXqPzyUp9AvRa4dW vdMbYqohMcIACE985uZfNVK+2QeVpb3Y6IOC4NsQ50PT9mD8T8Te+5U 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. Signed-off-by: Ricardo Neri --- Changes in v4: * Introduced this patch. Changes in v3: * N/A Changes in v2: * N/A --- kernel/sched/fair.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f4ed841f766f..229f32cebf1f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -12924,6 +12924,7 @@ static struct rq *sched_balance_find_src_rq(struct lb_env *env, int i; for_each_cpu_and(i, sched_group_span(group), env->cpus) { + bool smt_degraded_cap = sched_smt_active() && !is_core_idle(i); unsigned long capacity, load, util; unsigned int nr_running; enum fbq_type rt; @@ -12964,8 +12965,12 @@ 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. + * + * Busy SMT siblings reduce the capacity of CPU i. Do not skip + * it in this case. */ if (env->sd->flags & SD_ASYM_CPUCAPACITY && + !smt_degraded_cap && !capacity_greater(capacity_of(env->dst_cpu), capacity) && nr_running == 1) continue; -- 2.43.0