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 99BB636A377 for ; Mon, 22 Jun 2026 23:55:35 +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=1782172546; cv=none; b=mxjYCwlEpVafsDN06jDR5CCRcbTLm6FR+YxQY/tTWsvV5x89f/vhxWHqxTGToXijd2Zh8X4vcBQ+OSWOhAFZor1a3iZjFF/0nKPN8aq1EjDRS40/+/3sR9pvZJYoKY8pDUXHyQv6xvCPP66lY3phUcQkNgYrTL/L25jd0Y/HMJA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782172546; c=relaxed/simple; bh=J4+/+R6VTGfzsFmzqKqyh/tsCycDY1llfY6VbmDL8VI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=j///IISm6pqnu2jXBRjQIQRkjBCp7LCmns/mi51BH2eA7HaVuYBch6IAOos8e4CkbrcwUfR0+A0VDucKh7V267KwYIrZbA9WheimSmai5IHkbkYv3P+wI5rQz5Dj6KbMpc9HZ1zFc2wT0flOfMmWJL6eTo48EWzF4WKIAwd9k1w= 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=iNozAGBL; 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="iNozAGBL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1782172536; x=1813708536; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=J4+/+R6VTGfzsFmzqKqyh/tsCycDY1llfY6VbmDL8VI=; b=iNozAGBLfANfQJNX5585ExShUPB3YVmbAn+LE2aCH0C1JvupXKhGEWtU 9AQnk4JfdtywLUrUtfkkONUo2a/2NpIWEKSJh2RAdCTqV6Urf+a8UC3VM ypaKBq5eBEXw7sTmL9xKtdcfxZo5NKfcm4T2zXTJGbsQIK5p3mUid27Jn m6GhfYK85WXkKICrqI4VQDjt5a082IsLBr/3gJRZURT1GUV6LLZZExEbt WcznJicckF/aq9///kregCaajuslJI7m4SFHqyyS8HSeokwZ+ouWSmVdh drBZvTHC+aGmBXN5T6D2ZGbY6Q6JR8Qcr0gjXYS9odFJ+H6G1pU2CNcHq Q==; X-CSE-ConnectionGUID: 2Q07oUGvQCG/VjjyQRpb5g== X-CSE-MsgGUID: aAdQBugPRR2IyUy57fX1BQ== X-IronPort-AV: E=McAfee;i="6800,10657,11825"; a="82014513" X-IronPort-AV: E=Sophos;i="6.24,219,1774335600"; d="scan'208";a="82014513" 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: ltpl03PpR/m09H7/9TzoNg== X-CSE-MsgGUID: pGbBQIHWTwq72PXhhuv06A== 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:54 -0700 Subject: [PATCH v5 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: <20260622-rneri-fix-cas-clusters-v5-4-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=3269; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=J4+/+R6VTGfzsFmzqKqyh/tsCycDY1llfY6VbmDL8VI=; b=2aC3YEOTCYnEEnLsCOUdWqLrUhy8uEpKALBw3NmLwxL0hqDBE6sQ0V+MejeoXfSDXAZuN15Tw SU9au2e8V5MC4OTyiEWiReKMh3DSl0aVybkPbAVnB6Av9W6uatjK+e9 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 Tested-by: Christian Loehle Signed-off-by: Ricardo Neri --- Changes in v5: * Added Tested-by tag from Christian. Thanks! 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 030675e249b5..e55eb019d2c9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11860,12 +11860,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