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 9B5B75695 for ; Mon, 8 Dec 2025 12:34:00 +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=1765197243; cv=none; b=c9ZGJx1IgzfpRKXPC7D4VmGTATdXo1vlltDA66rSZaqgbmB1EddEMqnTXe+HF1zEsaG71/C0gjMNjH1NQn4o8m6C+nNACCZUx1IiJEDWyk26tGXAmqF907QJuoeRZUkiFqMVPkBNh1d4+8ARBFHFx5dNty0PwVGPjiDIl/UUhJk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765197243; c=relaxed/simple; bh=KmBsp5sBSChjmiDhOcB6nWLtAYyTLHcVpW0OYOpdRts=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Ri8nEjjX4H0Cf8GK+VgAI31XCQbKDUPMYieFWIgS60YwRnId4jz1qzc6ZlZBl02HMKLXIQ86yU9I7W2JzbeSVZYpJVF5oXr7BFiUAgkTBGtOsmNpWz37rLl/5hoCYqYFVjySPTIW9DxpEhzXFPd8Bdh/uB46g4/LirlZSbsmiFY= 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; 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 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 659E01691; Mon, 8 Dec 2025 04:33:52 -0800 (PST) Received: from [10.1.31.65] (e127648.arm.com [10.1.31.65]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8EEEC3F740; Mon, 8 Dec 2025 04:33:55 -0800 (PST) Message-ID: <861ae06a-5c9a-47ce-a290-709785b28833@arm.com> Date: Mon, 8 Dec 2025 12:33:53 +0000 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: [RESEND RFC PATCH v2 28/29] [EXPERIMENTAL] sched/fair: Add a local counter to rate limit task push To: K Prateek Nayak , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , "Gautham R. Shenoy" , Swapnil Sapkal , Shrikanth Hegde , Chen Yu References: <20251208083602.31898-1-kprateek.nayak@amd.com> <20251208092744.32737-28-kprateek.nayak@amd.com> Content-Language: en-US From: Christian Loehle In-Reply-To: <20251208092744.32737-28-kprateek.nayak@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/8/25 09:27, K Prateek Nayak wrote: > Pushing tasks can fail for multitude of reasons - task affinity, the > unavailability of an idle CPUs by the time balance callback is executed, > etc. > > Maintain a CPU local counter in sched_domain to rate limit push attempts > if the failures build up. This counter is reset at the time of periodic > balance to the value in "nr_idle_scan". > > Since "nr_idle_scan" is only computed for SIS_UTIL, rate limiting has > been guarded behind the same sched_feat(). > > Signed-off-by: K Prateek Nayak > --- > include/linux/sched/topology.h | 4 ++++ > kernel/sched/fair.c | 23 +++++++++++++++++++++-- > 2 files changed, 25 insertions(+), 2 deletions(-) > > diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h > index 074ee2980cdf..ebe26ce82c1a 100644 > --- a/include/linux/sched/topology.h > +++ b/include/linux/sched/topology.h > @@ -122,6 +122,10 @@ struct sched_domain { > unsigned int alb_failed; > unsigned int alb_pushed; > > + /* Push load balancing */ > + unsigned long last_nr_push_update; > + int nr_push_attempt; > + > /* SD_BALANCE_EXEC stats */ > unsigned int sbe_count; > unsigned int sbe_balanced; > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 34aeb8e58e0b..46d33ab63336 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -12356,6 +12356,16 @@ static void sched_balance_domains(struct rq *rq, enum cpu_idle_type idle) > rq->max_idle_balance_cost = > max((u64)sysctl_sched_migration_cost, max_cost); > } > + if (sched_feat(SIS_UTIL)) { > + sd = rcu_dereference(per_cpu(sd_llc, cpu)); > + > + if (sd && sd->shared && > + time_after_eq(jiffies, sd->last_nr_push_update + sd->min_interval)) { > + sd->nr_push_attempt = READ_ONCE(sd->shared->nr_idle_scan); > + sd->last_nr_push_update = jiffies; > + } > + } > + > rcu_read_unlock(); > > /* > @@ -13110,8 +13120,6 @@ static inline bool should_push_tasks(struct rq *rq) > struct sched_domain *sd; > int cpu = cpu_of(rq); > > - /* TODO: Add a CPU local failure counter. */ > - > /* CPU doesn't have any fair task to push. */ > if (!has_pushable_tasks(rq)) > return false; > @@ -13126,6 +13134,10 @@ static inline bool should_push_tasks(struct rq *rq) > if (!sd) > return false; > > + /* We've failed to push task too many times. */ > + if (sched_feat(SIS_UTIL) && sd->nr_push_attempt <= 0) > + return false; > + > /* > * We may not be able to find a push target. > * Skip for this tick and depend on the periodic > @@ -13176,6 +13188,13 @@ static bool push_fair_task(struct rq *rq) > return true; > } > > + /* > + * If the push failed after a full search, decrement the > + * attempt counter to dicourage further attempts. Periodic > + * balancer will reset the "nr_push_attempt" after a while. > + */ > + sd->nr_push_attempt--; > + > return false; > } > Just to confirm, but this patch is included when the cover letter mentions "push" for the benchmarks? Did this help the regressions then?