From: Kayra Cizmeci <kayracizmeci@gmail.com>
To: vincent.guittot@linaro.org, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>
Cc: linux-kernel@vger.kernel.org, qyousef@layalina.io
Subject: Re: [PATCH 7/8] sched/eevdf: Compare min slice during wake_affine
Date: Sat, 26 Sep 2026 21:18:40 +0300 [thread overview]
Message-ID: <20260926181840.3107-1-kayracizmeci@gmail.com> (raw)
In-Reply-To: <20260921152238.3804392-8-vincent.guittot@linaro.org>
Hi Vincent,
> Add a new level in wake affine where we check on which CPU the task
> would most probably run 1st between this and prev CPUs.
> @@ -8402,6 +8402,9 @@ static int wake_wide(struct task_struct *p)
> * wake_affine_idle() - only considers 'now', it check if the waking CPU is
> * cache-affine and is (or will be) idle.
> *
> + * wake_affine_slice() - only considers 'now', it check if the waking CPU can
> + * be preempted because using longer slice.
> + *
> * wake_affine_weight() - considers the weight to reflect the average
> * scheduling latency of the CPUs. This seems to work
> * for the overloaded case.
> @@ -8437,6 +8440,20 @@ wake_affine_idle(int this_cpu, int prev_cpu, int sync)
> return nr_cpumask_bits;
> }
> +static int
> +wake_affine_slice(struct task_struct *p, int this_cpu, int prev_cpu)
> +{
> + struct sched_entity *se = &p->se;
> +
> + if (se->slice < get_rq_min_slice(cpu_rq(prev_cpu)))
> + return prev_cpu;
> +
> + if (se->slice < get_rq_min_slice(cpu_rq(this_cpu)))
> + return this_cpu;
> +
> + return nr_cpumask_bits;
> +}
> +
> static int
> wake_affine_weight(struct sched_domain *sd, struct task_struct *p,
> int this_cpu, int prev_cpu, int sync)
> @@ -8488,6 +8505,9 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p,
> if (sched_feat(WA_IDLE))
> target = wake_affine_idle(this_cpu, prev_cpu, sync);
>
> + if (sched_feat(PREEMPT_SHORT) && target == nr_cpumask_bits)
> + target = wake_affine_slice(p, this_cpu, prev_cpu);
> +
> if (sched_feat(WA_WEIGHT) && target == nr_cpumask_bits)
> target = wake_affine_weight(sd, p, this_cpu, prev_cpu, sync);
>
> --
> 2.53.0
this_cpu has min_slice of 7 while prev_cpu has min_slice of 5.
se->slice == 4, so on wake_affine_slice() prev_cpu is chosen.
Ain't getting onto a cpu with bigger min_slice is better for us?
If so, is this works for you?
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 09f0667e97a2..e50c339e5c2d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8444,14 +8444,13 @@ static int
wake_affine_slice(struct task_struct *p, int this_cpu, int prev_cpu)
{
struct sched_entity *se = &p->se;
+ u64 min_prev = get_rq_min_slice(cpu_rq(prev_cpu));
+ u64 min_this = get_rq_min_slice(cpu_rq(this_cpu));
- if (se->slice < get_rq_min_slice(cpu_rq(prev_cpu)))
- return prev_cpu;
-
- if (se->slice < get_rq_min_slice(cpu_rq(this_cpu)))
- return this_cpu;
+ if (se->slice >= max(min_prev, min_this))
+ return nr_cpumask_bits;
- return nr_cpumask_bits;
+ return min_prev >= min_this ? prev_cpu : this_cpu;
}
static int
Thanks,
Kayra
next prev parent reply other threads:[~2026-09-26 18:19 UTC|newest]
Thread overview: 32+ 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 [this message]
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
2026-10-02 15:46 ` Vincent Guittot
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=20260926181840.3107-1-kayracizmeci@gmail.com \
--to=kayracizmeci@gmail.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®