From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 C69BA39EF2B for ; Thu, 14 May 2026 18:24:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778783053; cv=none; b=cBlGJG0bRbaAe6d7R3TaT86NtRSWKyEkwmKcw3hSWcMRl+5+7Wnh7aCtafffOz0F1hmPRAxx92GcKruLl6ZMM5/UR7LBtjeGK1qMW+9XvVImMH+5KL6JnXrTF0sWCT4ohChzRJqj1q+VamiJ6XByQ/+cfO8CunUxJvrDq226q/U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778783053; c=relaxed/simple; bh=qL8r+wnrJq4XPLRRMrn6L7qhI9j4aqhNun2yMF4OSSM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cqGmerlCjJoq4bAQN6vQs4SR0TtyKwuhO2/2X8QjdkiOVKREkORcWcSe99K2U/nQIkmVRnj4pmhaJjCEbHFUHJQ+iDpSrDm3MfRyFI3t1E5yzpTVRS9oHyFIboi65UnplaK1P/b7gvL1vPfaAYZ2EkA1Xp/y8d3mciK62fVlfRY= 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=Rt8brL6j; arc=none smtp.client-ip=192.198.163.13 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="Rt8brL6j" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778783052; x=1810319052; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=qL8r+wnrJq4XPLRRMrn6L7qhI9j4aqhNun2yMF4OSSM=; b=Rt8brL6jE34Nw9IIA44bfyKoT/+MEeh69EwOs/ug3MP17QANcxBXk/Xl AC8EU8u3csfmhPAoTzdC9GiMtREneCF5QUYfytZnuwnCC9v9NofNY6K/G RdjZRmZsnfv92lOq0ZTi38PAkqSF3gQeWCl+0THP5poh6jZxEcAFP82GK LJ824w+U4TYUx4TjnXsPwOYpIF0/eQr6eR2Uv/qjVfcbA2wmJUI/Ga3zN eQYBN6Xovo9dK3YP1a7EuZVNQo/1IaGDFne2XB6OF8E7gNjfXW4fcoq1Y AXHFjB7iKkqFX8rgOjfIiJdBMoK0B8VJxzM1BMTVOXk51vKA1PYE9qAMW Q==; X-CSE-ConnectionGUID: 5q6RSrHEQj21AWygz+soHg== X-CSE-MsgGUID: zEKyMnr7T5W/1kPa1s9Bvg== X-IronPort-AV: E=McAfee;i="6800,10657,11786"; a="82303133" X-IronPort-AV: E=Sophos;i="6.23,235,1770624000"; d="scan'208";a="82303133" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2026 11:24:08 -0700 X-CSE-ConnectionGUID: dZ3L7u6XRaezVKlu2qq6jg== X-CSE-MsgGUID: Qw4500y+Rumz61TRvE4qkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,235,1770624000"; d="scan'208";a="234181042" Received: from unknown (HELO [172.25.112.21]) ([172.25.112.21]) by fmviesa010.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2026 11:24:08 -0700 From: Ricardo Neri Date: Thu, 14 May 2026 11:34:38 -0700 Subject: [PATCH v3 2/4] 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: <20260514-rneri-fix-cas-clusters-v3-2-0037869554bd@linux.intel.com> References: <20260514-rneri-fix-cas-clusters-v3-0-0037869554bd@linux.intel.com> In-Reply-To: <20260514-rneri-fix-cas-clusters-v3-0-0037869554bd@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=1778783711; l=2928; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=qL8r+wnrJq4XPLRRMrn6L7qhI9j4aqhNun2yMF4OSSM=; b=eBYOpBT8W10xfQNo69OxUJfgLvsdf7P6/RKsVlc5rYEAHopbBJKoTZvKDCDDVqpE/0poJ2cvc ufI5R45YoP6ADoT0S/73ERFG9dWsx1gJ4Y2nR391+jMM0bIgmmbqKTG 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 Signed-off-by: Ricardo Neri --- 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 | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e06e74d9ce0e..dcc02ceb44b5 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -10749,10 +10749,24 @@ 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 domain overloaded so big CPUs + * can pick up misfit tasks via newly idle + * balance. + */ *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