From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECA37285041 for ; Fri, 6 Feb 2026 18:30:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770402621; cv=none; b=HjJKCdWD1t8V3P3CbYkzCOWsZ4hSkrqjeDgYQqs0Os+g4rYA1Am8KM9xDYPTg0OMKZXT4Gv/X+t/o0076Av5DP/d8aio50qDWwnj4P5qZiVR4phBgrlrxx+Refodcj9iXNTseZzTSJIXJOAfZ0n7bCYiYLrk1donwO05CXSi2d0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770402621; c=relaxed/simple; bh=O/T6lIeGRBpWTGbmfn0jskD/atyT06x3MXb846hFe1Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OgI1ch4Mb124WITCEoDUClNAsGd7Y5HtzhF+tYSRgd9Vsc+NdOlEVsVHaj3+i9hi5i85vo2Pamp3OMLCyDg0qg4RLYpYV+3+dvhZ4iZIXSqxIIvdAJxo/qYUeKHDbtPsWMIPve80hQUNeGbuzr392EaLxntVhZVK9waS54C2gNA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=layalina.io; spf=pass smtp.mailfrom=layalina.io; dkim=pass (2048-bit key) header.d=layalina-io.20230601.gappssmtp.com header.i=@layalina-io.20230601.gappssmtp.com header.b=rGbk9aHr; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=layalina.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=layalina.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=layalina-io.20230601.gappssmtp.com header.i=@layalina-io.20230601.gappssmtp.com header.b="rGbk9aHr" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-481188b7760so18065015e9.0 for ; Fri, 06 Feb 2026 10:30:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20230601.gappssmtp.com; s=20230601; t=1770402619; x=1771007419; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=UVeExnBLn54ujjjUcOJS/pItP9R9EHfR+VrmLyviDS4=; b=rGbk9aHrjyXTNiZxokZYew+RyHiYMSmSce0dGOYQv5qmh18D9ePlJTKrSAQuYJvUFa 4EtdtxCl7zzJJl4KU2IdIceg4P0HKcW01it1EIl2AEt0Irzb1LwaewA4jBpi78omL80x Hyahtxfwc8vwyMkqi63HvqnPkG8CnryqCOCxBwbmMAxJone0xFkXGs9ziDdlTa7Q5Mlc wwHj71jTWsoAieDtYj9sKB0C1Txar0G7X9idhyZ8KFaoJI/JNxbesoY4iafernbIljpi dEp6txZrIdt02L+kTXp56RIlcAH9enIUsOwfG/ZafntnJjFyBVt5U96uvNuMDUWwhH5n etRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770402619; x=1771007419; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UVeExnBLn54ujjjUcOJS/pItP9R9EHfR+VrmLyviDS4=; b=D6CYnRkvlZlzmlpwtbSSX8f89Hf16w4Xqf6UU8C+RO2GN2zEd9IukQrk6lFSFZxElX A6D4GzokhO5gwhDKi3eNKTGxVG7ca9etDigCWhrFvUh70vbsLTMVzbDr1OlbUZ13dgZk jo5sQuMJt6mQ83swlSzxVQF/7ti8JyC0sECTs88EOduapECIJi8ZmStHAV4hb8bfA7QT p4CC7YYjwSKOmrwB6cHqdrms/U7P4WLEX0V5LbPmVdpqHrFfDxtcrRvZpT+SLxhMj/1Z 8aeSC95Y+rnfigkJRn5rKkhfutLoO3MtXnBcVc67dmpf0Ey0v/nMnSF5yNFkg4KL0W71 e3NA== X-Forwarded-Encrypted: i=1; AJvYcCWfOn3FBafiERr00rCsW8KIEBdb/ZzNUn+QuWs3xtayqp4cMAVAjscJWBhgjJefP0lQpdpqRN5FWG4t0Zk=@vger.kernel.org X-Gm-Message-State: AOJu0YzO0eP/eQF0QL4KjOEc2czcWm+bJ8rzKcLhfsI5OBVCHgm5simx 8r3grEEZ1LwpZbbT2EFsjc3zWVQ9Dofg2PYEeBqgTGM+he6e3Q9zmg47YPzRnaY5ryo= X-Gm-Gg: AZuq6aIqvupdbAhWqkCsYq5m8yrTTeDaiURAwX4Ik9uQcJlYnd9cvMY3U2IcaWdWsI1 sz0wrLcc+DXBlQvYpkNJyL2F6TbpvYBBv4A+RQ3tXmSSmUnxWFrVQL3Culrd2l54jvHNUtDSSZB 3/Isd5livsPXhSKx/+LrTwMMOEKgGYB/XxkBgAkKcPUU2hwpodVvnlY7H0PwdcwuYjNBSnz7Gj0 Wm9MJRTXL9BuCwgkNBaq29RC5Bzc80dRqU8PVyNFAww9kXHwCUOinqnsQrK7H4jv4iyfq4JWPY/ rw4pDclnZMbMIUSrcQuF1FDhdL1auhXEvsTij5oF3sVmnUZeA4unxOwwGU8wMbHO+WcqSzSI2Qa aqW/vSTjN4A/0V4OO2IT4tzp9d1pFMQMxwdolBKO+RyzeL+fj6qRYmM4JJYz4phKOH8WGr1C7+s bJp/SHmvKY/BbZwt+LwliSUErQvMHYrM0xIH4jgAyF0oZk1RWkuuVrR+YPvMTe8aI= X-Received: by 2002:a05:600c:35c7:b0:47e:e2eb:bc22 with SMTP id 5b1f17b1804b1-483209291fbmr50500615e9.5.1770402619301; Fri, 06 Feb 2026 10:30:19 -0800 (PST) Received: from airbuntu (host109-153-232-30.range109-153.btcentralplus.com. [109.153.232.30]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48317d8341csm138432645e9.13.2026.02.06.10.30.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Feb 2026 10:30:18 -0800 (PST) Date: Fri, 6 Feb 2026 18:30:17 +0000 From: Qais Yousef To: Vincent Guittot Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, linux-kernel@vger.kernel.org, pierre.gondois@arm.com, kprateek.nayak@amd.com, hongyan.xia2@arm.com, christian.loehle@arm.com, luis.machado@arm.com Subject: Re: [RFC PATCH 6/6 v8] sched/fair: Add EAS and idle cpu push trigger Message-ID: <20260206183017.ovewgke6r4cvt5pf@airbuntu> References: <20251202181242.1536213-1-vincent.guittot@linaro.org> <20251202181242.1536213-7-vincent.guittot@linaro.org> 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-Disposition: inline In-Reply-To: <20251202181242.1536213-7-vincent.guittot@linaro.org> On 12/02/25 19:12, Vincent Guittot wrote: > EAS is based on wakeup events to efficiently place tasks on the system, but > there are cases where a task doesn't have wakeup events anymore or at a far > too low pace. For such cases, we check if it's worth pushing the task on > another CPUs instead of putting it back in the enqueued list. > > Wake up events remain the main way to migrate tasks but we now detect > situation where a task is stuck on a CPU by checking that its utilization > is larger than the max available compute capacity (max cpu capacity or > uclamp max setting). > > When the system becomes overutilized and some CPUs are idle, we try to > push tasks instead of waiting periodic load balance. I am fine with these wording. But I think enable lb based on power is a very good description too. Basically we don't have the concept on down migration for HMP systems to help save power for tasks that are hinted are fine with running at lower performance level via uclamp_max. > > Signed-off-by: Vincent Guittot > --- > kernel/sched/fair.c | 64 +++++++++++++++++++++++++++++++++++++++++ > kernel/sched/topology.c | 2 ++ > 2 files changed, 66 insertions(+) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 0c0c675f39cf..e9e1d0c05805 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -8500,8 +8500,72 @@ static inline bool sched_push_task_enabled(void) > return static_branch_unlikely(&sched_push_task); > } > > +static inline bool task_stuck_on_cpu(struct task_struct *p, int cpu) > +{ > + unsigned long max_capa, util; > + > + max_capa = min(get_actual_cpu_capacity(cpu), > + uclamp_eff_value(p, UCLAMP_MAX)); I think we check if uclamp_max is == SCHED_CAPACITY_SCALE. By definition these are not stuck. I found without this condition we can trigger this a lot unnecessarily. > + util = max(task_util_est(p), task_runnable(p)); We must take the min(util, SCHED_CAPACITY_SCALE) here since runnable can get too large making the condition above true even if you are on the biggest capacity cpu. > + > + /* > + * Return true only if the task might not sleep/wakeup because of a low > + * compute capacity. Tasks, which wake up regularly, will be handled by > + * feec(). > + */ > + return (util > max_capa); > +} > + > +static inline bool sched_energy_push_task(struct task_struct *p, struct rq *rq) > +{ > + if (!sched_energy_enabled()) > + return false; > + > + if (is_rd_overutilized(rq->rd)) > + return false; > + > + if (task_stuck_on_cpu(p, cpu_of(rq))) > + return true; > + > + if (!task_fits_cpu(p, cpu_of(rq))) > + return true; > + > + return false; > +} > + > +static inline bool sched_idle_push_task(struct task_struct *p, struct rq *rq) > +{ > + if (rq->nr_running == 1) > + return false; > + > + if (!is_rd_overutilized(rq->rd)) > + return false; > + > + /* If there are idle cpus in the llc then try to push the task on it */ > + if (test_idle_cores(cpu_of(rq))) > + return true; > + > + return false; > +} > + > + > static bool fair_push_task(struct rq *rq, struct task_struct *p) > { > + if (!task_on_rq_queued(p)) > + return false; > + > + if (p->se.sched_delayed) > + return false; > + > + if (p->nr_cpus_allowed == 1) > + return false; > + > + if (sched_energy_push_task(p, rq)) > + return true; > + > + if (sched_idle_push_task(p, rq)) > + return true; In my testing (of earlier version of the patch) I found adding a new is_rq_overloaded(rq) test which simply checks if rq->nr_running > 1 is helpful to make the whole regular lb required at all (get rid of overutilized). Still testing it though, something to consider now or later. I don't mind. > + > return false; > } > > diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c > index cf643a5ddedd..00abd01acb84 100644 > --- a/kernel/sched/topology.c > +++ b/kernel/sched/topology.c > @@ -391,10 +391,12 @@ static void sched_energy_set(bool has_eas) > if (sched_debug()) > pr_info("%s: stopping EAS\n", __func__); > static_branch_disable_cpuslocked(&sched_energy_present); > + static_branch_dec_cpuslocked(&sched_push_task); > } else if (has_eas && !static_branch_unlikely(&sched_energy_present)) { > if (sched_debug()) > pr_info("%s: starting EAS\n", __func__); > static_branch_enable_cpuslocked(&sched_energy_present); > + static_branch_inc_cpuslocked(&sched_push_task); > } > } > > -- > 2.43.0 >