mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: Vincent Guittot <vincent.guittot@linaro.org>,
	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,
	kprateek.nayak@amd.com, linux-kernel@vger.kernel.org
Cc: qyousef@layalina.io
Subject: Re: [PATCH 8/8] sched/eevdf: Add min slice check when selecting CPU
Date: Thu, 1 Oct 2026 16:15:45 +0100	[thread overview]
Message-ID: <b37e8f1c-0cc7-4ca1-9e40-620d908464bf@arm.com> (raw)
In-Reply-To: <20260921152238.3804392-9-vincent.guittot@linaro.org>

On 9/21/26 16:22, Vincent Guittot wrote:
> Add a new level for selecting CPU when select_task_rq_fair() fails to find
> an idle CPU. This last level will compare the slice to select a CPU where
> the task could run 1st.
> This helps a waking task to select a CPU where a longer slice runs
> instead of one where a task with the same or shorter slice already runs.
> 
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
>  kernel/sched/fair.c | 63 ++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 62 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 452da94289fe..5c9add3e853c 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9023,6 +9023,59 @@ static inline bool asym_fits_cpu(unsigned long util,
>  	return true;
>  }
>  
> +static int select_slice_cpu(struct task_struct *p, struct sched_domain *sd, int target)
> +{
> +	unsigned long task_util, util_min, util_max;
> +	int cpu, nr = INT_MAX;
> +	u64 slice = p->se.slice;
> +	struct cpumask *cpus;
> +
> +	if (sched_feat(SIS_UTIL) && sd->shared) {
> +		/*
> +		 * Same nr_idle_scan hint as select_idle_cpu(), nr only limits
> +		 * the scan when not preferring an idle core.
> +		 */
> +		nr = READ_ONCE(sd->shared->nr_idle_scan) + 1;
> +		/* overloaded domain is unlikely to have idle cpu/core */
> +		if (nr == 1)
> +			return -1;
> +	}
> +
> +	cpus = this_cpu_cpumask_var_ptr(select_rq_mask);
> +	cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr);
> +
> +	if (sched_asym_cpucap_active()) {
> +		task_util = task_util_est(p);
> +		util_min = uclamp_eff_value(p, UCLAMP_MIN);
> +		util_max = uclamp_eff_value(p, UCLAMP_MAX);
> +	}
> +
> +	/* Those CPUs have been tested not being idle and fiting */
> +	for_each_cpu_wrap(cpu, cpus, target) {
> +		/*
> +		 * Stop when the nr_idle_scan is exhausted (mirrors
> +		 * select_idle_cpu() logic).
> +		 */
> +		if (--nr <= 0)
> +			return -1;
> +
> +		if (slice >= get_rq_min_slice(cpu_rq(cpu)))
> +			continue;

Maybe even additionally look for the rq with smallest
current->vprot - current->vruntime?

It's an interesting approach, OTOH of course it disincentivizes longer slice
tasks again. I'd be interested what this looks like on a full workload
with different slice lengths.

      parent reply	other threads:[~2026-10-01 15:15 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 15:22 [PATCH 0/8] Improving latency of short slice tasks Vincent Guittot
2026-09-21 15:22 ` [PATCH 1/8] sched/eevdf: Ensure that vprot will never go above a min slice Vincent Guittot
2026-09-25 10:54   ` [tip: sched/core] " tip-bot2 for Vincent Guittot
2026-09-21 15:22 ` [PATCH 2/8] sched/eevdf: Align update_protect_slice to set_protect_slice Vincent Guittot
2026-09-25 10:54   ` [tip: sched/core] " tip-bot2 for Vincent Guittot
2026-09-21 15:22 ` [PATCH 3/8] sched/eevdf: Handle more short slice waking cases Vincent Guittot
2026-09-25 10:54   ` [tip: sched/core] " tip-bot2 for Vincent Guittot
2026-09-21 15:22 ` [PATCH 4/8] sched/eevdf: Decay positive lag of sleeping entities Vincent Guittot
2026-09-22 10:02   ` Peter Zijlstra
2026-09-22 10:40     ` Peter Zijlstra
2026-09-22 12:56     ` Vincent Guittot
2026-09-22 13:28       ` Peter Zijlstra
2026-09-22 14:21         ` Vincent Guittot
2026-09-21 15:22 ` [PATCH 5/8] sched/eevdf: Reset lag when waking up on idle cpu Vincent Guittot
2026-09-21 16:06   ` Kayra Cizmeci
2026-09-22  5:56     ` Vincent Guittot
2026-09-22 10:13   ` Peter Zijlstra
2026-09-22 14:20     ` Vincent Guittot
2026-09-22 14:32     ` Kayra Cizmeci
2026-09-21 15:22 ` [PATCH 6/8] sched/eevdf: Add per cpu cached min_slice Vincent Guittot
2026-09-22 10:17   ` Peter Zijlstra
2026-09-22 14:19     ` Vincent Guittot
2026-09-21 15:22 ` [PATCH 7/8] sched/eevdf: Compare min slice during wake_affine Vincent Guittot
2026-09-26 18:18   ` Kayra Cizmeci
2026-09-29 12:39     ` Vincent Guittot
2026-09-21 15:22 ` [PATCH 8/8] sched/eevdf: Add min slice check when selecting CPU Vincent Guittot
2026-09-22 10:46   ` Peter Zijlstra
2026-09-22 12:31     ` Vincent Guittot
2026-09-27  7:45       ` Kayra Cizmeci
2026-09-29 12:42         ` Vincent Guittot
2026-10-01 15:15   ` Christian Loehle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b37e8f1c-0cc7-4ca1-9e40-620d908464bf@arm.com \
    --to=christian.loehle@arm.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=qyousef@layalina.io \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®