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 381AA26059D for ; Mon, 8 Jun 2026 12:47:19 +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=1780922845; cv=none; b=T/Nh0ax80cH+I+r4yoB0qzkViGIrLWl6LymDEgnllZCH7uPbpD4FmsirisvUYGidk8cWqO3l2BlVqcH3qfz7RLNt4gBei8bjdDvWCmIeV4MIDm4CVTBH7oblljqtY82FGsVjGXxoypaiGLxdmrUgRIfRcUywX3RR3g8Xbf1l/cA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780922845; c=relaxed/simple; bh=toNAxFLJrB8iY20xTgp65NMOM25Ww2fDrd1TpcUZKj4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IGDFREomeP9ZIFnvHv06mGzaR6CHX5Tl2Nti1JIiGrFaRRdPXxPwE3ZZmSJDOXy0iv+HxpqfSCKQzP82uWqpFPe2KOVLh8cPTOESkT3erISG7fKlJLGxjDq6EWxZOYat0NvrnmQm3DaOLyMQyE9+EJpzZapDkjXENzokmaffYWI= 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=fZdTsufn; 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="fZdTsufn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1780922839; x=1812458839; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=toNAxFLJrB8iY20xTgp65NMOM25Ww2fDrd1TpcUZKj4=; b=fZdTsufnlSkluQgkXPv9u3tq3qxD5VoIHmEmAogq+nIciLzj4tCRd3i7 J1CEFsndXYIMC8+QUaFRlwAqt4uXAcgyMiQxUWRDKKFLOwiALGexzPG6a XdGo9b8+izJagAIAV+DmPv1a/oBwT+WWcJhVMoBGR27BOZ0BSLxKhR5SB o9y/l1C6/hXT2f7J5oHClW1iIc4XV/0O4eDPua2rFs/XZ83BUSays2SUa FlwV37ZnBegJfllf/V7O9S5rQ1Bl8GSF3NU0aIg0eBB7x2E/yuPFQH5yH 13bnEBAALoJjZ48v3jcb3MwHqtOllavMS0T5LgW6MVdOM1L2ncKty8y3V w==; X-CSE-ConnectionGUID: /csUaKmXSsOarHb4WSKrxw== X-CSE-MsgGUID: KSZ2dGjnT0WvW613bq2zig== X-IronPort-AV: E=McAfee;i="6800,10657,11810"; a="85281930" X-IronPort-AV: E=Sophos;i="6.24,194,1774335600"; d="scan'208";a="85281930" 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: RrpliyIjTben3eoDZzjHZg== X-CSE-MsgGUID: J/V2boXWRWGCwaiCLhHO2w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,194,1774335600"; d="scan'208";a="247409316" 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:15 -0700 From: Ricardo Neri Date: Mon, 08 Jun 2026 05:57:14 -0700 Subject: [PATCH v4 4/6] sched/fair: Skip misfit load accounting when the destination CPU cannot help 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-4-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=3147; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=toNAxFLJrB8iY20xTgp65NMOM25Ww2fDrd1TpcUZKj4=; b=/jq0pFzuQzDLStUkrmt9wzmntgBf8pWfhsdXdtw+nOJret46qzcB1P4w+wQvBVh0JF+zoDZcY iBEaUjVaeBqCto4iTT/M/7e7eC0bTIqejYY5e8owgR0DQo07K05IMpI X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= In domains with asymmetric capacity, identifying misfit load in a scheduling group is not useful when the destination CPU cannot help (i.e., its capacity exceeds the group's maximum CPU capacity by less than ~5%). In such cases, it also prevents load balance among clusters of equal capacity when CONFIG_SCHED_CLUSTER is enabled. This happens because update_sd_pick_busiest() skips candidate groups of type misfit_task if the destination CPU has similar capacity. Skipping misfit load accounting in this situation allows the group to be classified as has_spare or fully_busy and lets load balancing proceed. Keep marking scheduling groups as overloaded when misfit tasks are present. The sg_overloaded flag propagates to the root domain and allows bigger CPUs in it to help via newly idle balance. Reviewed-by: Christian Loehle Reviewed-by: Chen Yu Reviewed-by: Vincent Guittot Signed-off-by: Ricardo Neri --- Changes in v4: * Added Reviewed-by tags from Vincent and Chen Yu. Thanks! Changes in v3: * Added Reviewed-by tag from Christian. Thanks! Changes in v2: * Moved the check of the destination CPU capacity inside the code block used for SD_ASYM_CPUCAPACITY. v1 inadvertently broke the mutual exclusion of the sched_reduced_capacity() path. * Keep marking the root domain as overloaded to allow bigger CPUs to help. (sashiko) * Fixed patch description to clarify that the capacity_greater() looks for differences of 5% or more. (Christian) * Reworded the patch description for clarity. * I did not include the Reviewed-by tag from Christian since the patch changed functionally. --- kernel/sched/fair.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a30ba02df688..77554d7410ff 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11850,12 +11850,25 @@ static inline void update_sg_lb_stats(struct lb_env *env, continue; if (sd_flags & SD_ASYM_CPUCAPACITY) { - /* Check for a misfit task on the cpu */ - if (sgs->group_misfit_task_load < rq->misfit_task_load) { - sgs->group_misfit_task_load = rq->misfit_task_load; - + if (rq->misfit_task_load) { + /* + * Always mark the root domain overloaded so big + * CPUs can pick up misfit tasks via newly idle + * balance. + */ if (balancing_at_rd) *sg_overloaded = 1; + + /* + * Only account misfit load if @dst_cpu can + * help; otherwise, the group may be classified + * as misfit_task and update_sd_pick_busiest() + * will skip it. + */ + if (capacity_greater(capacity_of(env->dst_cpu), + group->sgc->max_capacity) && + (sgs->group_misfit_task_load < rq->misfit_task_load)) + sgs->group_misfit_task_load = rq->misfit_task_load; } } else if (env->idle && sched_reduced_capacity(rq, env->sd)) { /* Check for a task running on a CPU with reduced capacity */ -- 2.43.0