From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 449F9449EB6 for ; Wed, 6 May 2026 11:39:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778067573; cv=none; b=qEAFHKNdUnZZKD42ZTG9J6ByGvcQ2Ds3RmW7p+NA/x55bSgGyFYsld8DAYMczx7QDYU4alP9XeW7HKOcS51QEJa2nI3hEbi1zvKZ2T3aebMay8dS4Y2wtq0Necla3feWUTx15R0F6DhvQ7pMk/b+JZ96I7GPJD4w8h8lv4X3rBA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778067573; c=relaxed/simple; bh=PiH3cntxYZ/sCgN2+IL25OjS/SImzgRp79L2ZHymiOQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jfDU0n6qiIP31Pi1M2rka0xwJZuuCc2z/ELzbWBNSFPz7891bGPIQmiyYSP3osvHdzuskGPyRutc6PDnR2F1GgUFh+46uaTwBO3LcZqhWtPStYNrwJ3Srqz8ELxpDHGbwykII9DyUTvkI7USKsUHKH2Khuj4BLWA9i5e0fCW+RU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=lBdD90p4; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="lBdD90p4" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3AB0C3319; Wed, 6 May 2026 04:39:25 -0700 (PDT) Received: from [10.57.92.61] (unknown [10.57.92.61]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6137D3F7B4; Wed, 6 May 2026 04:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778067570; bh=PiH3cntxYZ/sCgN2+IL25OjS/SImzgRp79L2ZHymiOQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=lBdD90p4Kq6d6m2UlePegg11wUgor2I5CzMrLTQ8MJbXLrPmGmu1eEKSRV6vtaxJg egtpcyN+DZe+SDtykE2eRR6U3xfERTgCaVS6DYce40YTWbrwkIudt+6GJbWysS5A7h lQ2KcPdW9bIIEqTN0+H6lR7dVQH/ksHO5j7z+IEc= Message-ID: <70613a6c-0a02-41c1-a70d-66fa8e40763b@arm.com> Date: Wed, 6 May 2026 12:39:23 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/4] sched/fair: Skip misfit load accounting when the destination CPU cannot help To: Ricardo Neri , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Tim C Chen , Chen Yu , Barry Song Cc: "Rafael J. Wysocki" , Len Brown , ricardo.neri@intel.com, linux-kernel@vger.kernel.org References: <20260429-rneri-fix-cas-clusters-v2-0-cd787de35cc6@linux.intel.com> <20260429-rneri-fix-cas-clusters-v2-2-cd787de35cc6@linux.intel.com> Content-Language: en-US From: Christian Loehle In-Reply-To: <20260429-rneri-fix-cas-clusters-v2-2-cd787de35cc6@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/29/26 22:19, Ricardo Neri wrote: > 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 */ > Reviewed-by: Christian Loehle