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 932D13B19D5 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=1777497712; cv=none; b=Mes1/mM8m5hg3fhbbKHPmeyl67uGHHy7vF334rjuwe1QjB0J9WwgxlEq7rHQPgQrLtwVtMPVAcyT0MrKW3CKEzsV7mKDym4NP05QT1ozuDaAQI44e9O5C3tEcWtBJmW/RB/TmNfSfbH40oAGq+qnfw6hANbXa6SbI6PwQ8IVYJA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777497712; c=relaxed/simple; bh=cmMXLhbK3Dzeq/KxSr+aCDYgrcwnpbbpcXbN98tD2HI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LmdWiC2SwYl51KPlfMd6kZCemid49pudH8kksFTsxPSdoHwL22HgPuTwJ+slTBXsfGIlthEbTkDdn6OiEkYqKUXD3CfHGHvIA9ErdK8varURq9u9nZ+PssY3INCYyytJhV2n50yZEnssfp89TYTFWORynEGH9zgb87W6ZHfGLII= 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=eq/OsbqN; 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="eq/OsbqN" 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=cmMXLhbK3Dzeq/KxSr+aCDYgrcwnpbbpcXbN98tD2HI=; b=eq/OsbqNOdJM2cv3dGcz7e5fRG3KSkYGIfgDpENSvarZcbD2YX2gL5am CwpzYEhiMrAKcqk88nSh+NuwzGRV1r+/6ScNncqoD5bEhcugcFSNrqIi7 POyRUan8a+5TzkAzD4JIn2cDU5pq6qAXbRU9sNPNiK+s/AhhmJrKPYW6n QdkWTOM4QFz5NdRyg2Y2J7Bs3bAw2n57kbxmbx70UGYvl4ZZcfauzHarx D/l12rGDC13ykx0LfO2eJWpNnEchbzbrbWe6ksSbZeI9AUs5z3qs2wmXH Riv6udZ5JcM1tk4+kQFyxawWWBGbfWvurgpAElZXiXqpKfTq9IcTSqFH3 Q==; X-CSE-ConnectionGUID: LsUnhGEdTXaoGmqF+KSi9g== X-CSE-MsgGUID: y75fTB8zTsmucrbuKDxuPA== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="88748758" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="88748758" 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: hX3EjMbPSwqLwx8xxigVqA== X-CSE-MsgGUID: 8UZsK07HTxeBnTjLGHoUAA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="234260041" 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:47 -0700 Subject: [PATCH v2 4/4] sched/topology: Do not clear SD_PREFER_SIBLING in domains with clusters 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-4-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=1867; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=cmMXLhbK3Dzeq/KxSr+aCDYgrcwnpbbpcXbN98tD2HI=; b=2yHRndo5DHczQBJJOBU1d6vwHYGGEeouGSn7NIRDZbL6+1cCzjv+al0C8nKN8shjrs/SJ12bn EhvWOWCyUCSDdu3cbqnIkE6aM/c2JvVDjrtgfAoppYOtp+NEzUcKZM3 X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= Some topologies have scheduling domains that contain CPUs of asymmetric capacity, grouped into two or more clusters of equal-capacity CPUs sharing an L2 cache. When CONFIG_SCHED_CLUSTER is enabled, load must be balanced across these resource-sharing clusters. Do not clear the SD_PREFER_SIBLING in the child domains to indicate to the load balancer that it should spread load among cluster siblings. Checks for capacity in the load balancer will prevent migrations from high- to low-capacity CPUs. Likewise, misfit load will still be used to move high-utilization tasks to bigger CPUs. Signed-off-by: Ricardo Neri --- Changes since v1: * Reworded the patch description for clarity. * Kept parentheses around bitwise operators for clarity. --- kernel/sched/topology.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 5847b83d9d55..78ffc1b8eaff 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -1723,8 +1723,15 @@ sd_init(struct sched_domain_topology_level *tl, /* * Convert topological properties into behaviour. */ - /* Don't attempt to spread across CPUs of different capacities. */ - if ((sd->flags & SD_ASYM_CPUCAPACITY) && sd->child) + /* + * Don't attempt to spread across CPUs of different capacities. An + * exception to this rule are domains in which there are clusters of + * CPUs sharing a resource. Keep the flag in such case to balance load + * among them. The load balancer will prevent task migrations from + * high- to low-capacity CPUs. + */ + if ((sd->flags & SD_ASYM_CPUCAPACITY) && sd->child && + !(sd->child->flags & SD_CLUSTER)) sd->child->flags &= ~SD_PREFER_SIBLING; if (sd->flags & SD_SHARE_CPUCAPACITY) { -- 2.43.0