Re: [tip:sched/eevdf] [sched/fair] e0c2ff903c: phoronix-test-suite.blogbench.Write.final_score -34.8% regression

From: Mike Galbraith
Date: Mon Aug 14 2023 - 14:34:07 EST


On Mon, 2023-08-14 at 15:29 +0200, Peter Zijlstra wrote:
>
> ---
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index fe5be91c71c7..16d24e5dda8f 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8047,6 +8047,15 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
>         cfs_rq = cfs_rq_of(se);
>         update_curr(cfs_rq);
>  
> +       if (sched_feat(WAKEUP_DEADLINE)) {
> +               /*
> +                * Only allow preemption if the virtual deadline of the new
> +                * task is before the virtual deadline of the existing task.
> +                */
> +               if (deadline_gt(deadline, pse, se))
> +                       return;
> +       }
> +
>         /*
>          * XXX pick_eevdf(cfs_rq) != se ?
>          */
> diff --git a/kernel/sched/features.h b/kernel/sched/features.h
> index 61bcbf5e46a4..e733981b32aa 100644
> --- a/kernel/sched/features.h
> +++ b/kernel/sched/features.h
> @@ -24,6 +24,7 @@ SCHED_FEAT(CACHE_HOT_BUDDY, true)
>   * Allow wakeup-time preemption of the current task:
>   */
>  SCHED_FEAT(WAKEUP_PREEMPTION, true)
> +SCHED_FEAT(WAKEUP_DEADLINE, true)
>  
>  SCHED_FEAT(HRTICK, false)
>  SCHED_FEAT(HRTICK_DL, false)

I don't have that phoronix thingy, but the above didn't seem to do
anything for hackbench here.

I whack eevdf with the stick below to dampen its scheduling enthusiasm
a little, and it did help the hackbench deficit some.

(yup, it's all rob Peter to pay Paul.. this game has no winner:)

hackbench -l 10000
avg
6.4.10-cfs 5.575 5.565 5.575 5.571
v cfs
6.4.10-eevdf 6.106 6.078 6.103 6.095 1.094
5.888 5.890 5.889 5.889 1.057 +RUN_TO_PARITY

---
kernel/sched/fair.c | 6 ++++++
kernel/sched/features.h | 1 +
2 files changed, 7 insertions(+)

--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -875,6 +875,12 @@ static struct sched_entity *pick_eevdf(s
if (curr && (!curr->on_rq || !entity_eligible(cfs_rq, curr)))
curr = NULL;

+ /*
+ * Once selected, run the task to parity to avoid overscheduling.
+ */
+ if (sched_feat(RUN_TO_PARITY) && curr)
+ return curr;
+
while (node) {
struct sched_entity *se = __node_2_se(node);

--- a/kernel/sched/features.h
+++ b/kernel/sched/features.h
@@ -7,6 +7,7 @@
SCHED_FEAT(PLACE_LAG, true)
SCHED_FEAT(PLACE_FUDGE, true)
SCHED_FEAT(PLACE_DEADLINE_INITIAL, true)
+SCHED_FEAT(RUN_TO_PARITY, true)

/*
* Prefer to schedule the task we woke last (assuming it failed