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 0D2633AE70F for ; Wed, 29 Apr 2026 21:21:47 +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=1777497709; cv=none; b=IUpfEmbOzmUzkfrXL5pc03OCeSId5HmhALX0HT/NM8K0wNAQWHvvStEydsHz8vF7XhKcergmA/+RF0H2zvEdcg9YDoJfbHs/HzSAHlVfQYrxT8ddixG2MfEKcJgRrULkT3gsSQHzjQygAzyorN+BnrGZNHfnUYW7J6s/dsat8GU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777497709; c=relaxed/simple; bh=n59Y7KiXKIGznfBdAZRxsuP0rvxNrHdaHG5xC2zO6K8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NxM6Gc/rJbMGreHGBdJDHcYR+8V3+uUan+c9Ot7yP+MQ1wDcE0331SW9Oz13HPHCeUjgpb0G3n+TeQn/BuozSZF8OJK47HckgCvHRavb4pAVpRDQHbMiIuGlvBN92KDVUYqmgzmbbB7sds++1/b73/DwTQjNt7GbdF6cci9sQ6U= 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=mzwzl5FN; 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="mzwzl5FN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777497708; x=1809033708; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=n59Y7KiXKIGznfBdAZRxsuP0rvxNrHdaHG5xC2zO6K8=; b=mzwzl5FNSHtC1qWYescQAynebINA7bXXtQLLLbQ4M9IIY0inqWALDBJy G8j791sGM3fRux7n46HqUw7QVOCDzuw2Tfnf/mq722tZzp5+TEW6SmM4s J87SEJHHwpWXeE6CAO4IT34g07HvxHooaMLwPFOwKXho8m22P7qWuXmWc Mc44gqEFtmszqFpUko/8DDxsHMuyy4EpgBz2ruoTLbLpl6gwjq2scpXQr qQwc0Lb8/JrAfJXIUtyJyBjbh7q6tHIV3UUwExbSVWeNlDfd9lsb7Vzzo vFfeTqjyetzdLq46Eaj0vdtTVoQQu0bnZGMTER9wvg0A+LDZTmGfR4z4x A==; X-CSE-ConnectionGUID: iZZDEh6HSr+iuipop0oiig== X-CSE-MsgGUID: oGO49mtPTWGBhSpP6Wo80A== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="88748743" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="88748743" 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:44 -0700 X-CSE-ConnectionGUID: yStbbOrqQzqFBeRHhO4YZA== X-CSE-MsgGUID: TT/OEYH2RkqzQzo0JngkEg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="234260030" 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:44 -0700 From: Ricardo Neri Date: Wed, 29 Apr 2026 14:19:45 -0700 Subject: [PATCH v2 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: <20260429-rneri-fix-cas-clusters-v2-2-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=2786; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=n59Y7KiXKIGznfBdAZRxsuP0rvxNrHdaHG5xC2zO6K8=; b=dmzpUn7SXtqQlOLlJIVIcTViBQVi1fzj4lfXnDchKbx/kLS9yyI0fjMX1mF/98erUiPanTHRD YwwjjTJr7rKDQNZb4sZugtyIFLiEqZPW5rfH8rikNFTY0Zctx08CR4l 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. This flag propagates to the root domain and allows bigger CPUs in it to help via newly idle balance. Signed-off-by: Ricardo Neri --- Changes since v1: * Moved the check of the destination CPU capacity inside the code block used for SD_ASYM_CPUCAPACITY. v1 inadvertedly 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 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 0dbed82aa63f..166a5b109e0e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -10719,10 +10719,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