From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (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 8FB3636607D for ; Mon, 22 Jun 2026 23:55:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782172535; cv=none; b=DLcgT3gc28OlY1iBcBb6pTL+NJ3/0ohE8Oj27wxKw51uQLmTv2DdkXwQQsOBJA12nrzfYjavI2Sl/1xzA5BvsFZbvhvmEKVsEq9eoLTqPwZV2pN/pKM8SHXMtLTv0X3PMJzqVVvulensT0GMIQluzO2j5lmUzKzotuxo+6nNwd0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782172535; c=relaxed/simple; bh=rIv5DUFF/rIw+1AEZVR7V7zJ0tyvCad2Xb+WNroBq84=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tLC1fJMQ007R7BofSe6+1iPvH659QMfpShwrDqh9siQHxlRdg5x2LW5Z1sLnoqb8SX6BWNfK4fxhN9yFV9V4fauJRzWXf/Hj9o39F6mDAX7yJgdyHSBwIFSFcxsVH0yFpCxVeA4buw7Fj/CYllQ7aP63jvESgk5K9rsbgqOhZ1I= 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=X4orRZc6; arc=none smtp.client-ip=192.198.163.18 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="X4orRZc6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1782172534; x=1813708534; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=rIv5DUFF/rIw+1AEZVR7V7zJ0tyvCad2Xb+WNroBq84=; b=X4orRZc6vyuJ9k/dvwRZIV1u9lT0UwkoUul/wkEFuj8VeWOGaOA3iYlR Z3JpO/SETCEVX971ANIEjxX9195WSqDtPvM4kUtGNlEpqgIDh+WqBxnjR gFgAXrY6P0nJfmbkQqNP45/HgoeDpEFPtM3kqJ4R0SGV+ScZPQR/T3JT+ g9oeer4DLjR6Oz98gnYdr3sJN2CMzv1N3WdN3pnwNWrtvwSiNzcORSgqV X2FjnlzIuIjrSKzVfzo3RPGh6cjNH0sQ/5gy/kd+j3aitsOcvykvSCwe9 KjMM8ztQyWik+GV7x9wvVxAO+Pps8MMvZZZYz4gLURqXCEXP6N3/HEFgU A==; X-CSE-ConnectionGUID: oeozvhlTSgS4pE8/4Bm/1w== X-CSE-MsgGUID: pGsXBzFfTFyGQvstCJzLPA== X-IronPort-AV: E=McAfee;i="6800,10657,11825"; a="82014479" X-IronPort-AV: E=Sophos;i="6.24,219,1774335600"; d="scan'208";a="82014479" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2026 16:55:31 -0700 X-CSE-ConnectionGUID: tWX+ML2BTA6ahZcvSTbOGQ== X-CSE-MsgGUID: flGQMeo5QdyQBBN/8gJZlg== X-ExtLoop1: 1 Received: from unknown (HELO [172.25.112.21]) ([172.25.112.21]) by fmviesa003.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2026 16:55:30 -0700 From: Ricardo Neri Date: Mon, 22 Jun 2026 17:05:51 -0700 Subject: [PATCH v5 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: <20260622-rneri-fix-cas-clusters-v5-1-19968f2d1497@linux.intel.com> References: <20260622-rneri-fix-cas-clusters-v5-0-19968f2d1497@linux.intel.com> In-Reply-To: <20260622-rneri-fix-cas-clusters-v5-0-19968f2d1497@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 , Barry Song Cc: "Rafael J. Wysocki" , Andrea Righi , 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=1782173185; l=2203; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=rIv5DUFF/rIw+1AEZVR7V7zJ0tyvCad2Xb+WNroBq84=; b=QQaaoBEpGHJH2mnYN+7N4TxkHRt8nJjnG4hOBsFaPZGoTIhTkirgMbgGWQ/Ho9jG2rRCag3tz p0Yb0withTYBQ5m7sSeCC2u7/ro2PcvdVfQlPGSAa83O9/a6Od7oaQ4 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 Signed-off-by: Ricardo Neri --- 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 d78467ec6ee1..892abd7fcc18 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -12976,9 +12976,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