diff --git a/linux-tkg-patches/6.5/0003-eevdf.patch b/linux-tkg-patches/6.5/0003-eevdf.patch index 947d358..df6d958 100644 --- a/linux-tkg-patches/6.5/0003-eevdf.patch +++ b/linux-tkg-patches/6.5/0003-eevdf.patch @@ -1,7 +1,7 @@ -From d931ed7fc8d6728204d36d31a18d4c8b60593821 Mon Sep 17 00:00:00 2001 +From 36fe8c8127c34a4f11bd765ca493046ea51b9062 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 31 May 2023 13:58:40 +0200 -Subject: [PATCH 01/16] sched/fair: Add cfs_rq::avg_vruntime +Subject: [PATCH 01/17] sched/fair: Add cfs_rq::avg_vruntime In order to move to an eligibility based scheduling policy, we need to have a better approximation of the ideal scheduler. @@ -295,10 +295,10 @@ index e93e006a9..4ccb73d85 100644 2.42.0 -From 4e5d4ab816239fc30595a76ffcd41c323bdd4996 Mon Sep 17 00:00:00 2001 +From 1d91e841fd914ff551a2fb1d4a491d2daccc988f Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 31 May 2023 13:58:41 +0200 -Subject: [PATCH 02/16] sched/fair: Remove sched_feat(START_DEBIT) +Subject: [PATCH 02/17] sched/fair: Remove sched_feat(START_DEBIT) With the introduction of avg_vruntime() there is no need to use worse approximations. Take the 0-lag point as starting point for inserting @@ -372,10 +372,10 @@ index ee7f23c76..fa828b365 100644 2.42.0 -From 49ba3e84689bb047d9411e8a3a6ae99020070f37 Mon Sep 17 00:00:00 2001 +From 1b7ae7e0939db6a3755332c771f132cb85de09d0 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 31 May 2023 13:58:42 +0200 -Subject: [PATCH 03/16] sched/fair: Add lag based placement +Subject: [PATCH 03/17] sched/fair: Add lag based placement With the introduction of avg_vruntime, it is possible to approximate lag (the entire purpose of introducing it in fact). Use this to do lag @@ -661,10 +661,10 @@ index fa828b365..7958a10fe 100644 2.42.0 -From 31462b52019e938357395e7bd0f630fcd550e27c Mon Sep 17 00:00:00 2001 +From ca2997665fe5bdca860ef2dc0f3072a1ef10e0d3 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 31 May 2023 13:58:43 +0200 -Subject: [PATCH 04/16] rbtree: Add rb_add_augmented_cached() helper +Subject: [PATCH 04/17] rbtree: Add rb_add_augmented_cached() helper While slightly sub-optimal, updating the augmented data while going down the tree during lookup would be faster -- alas the augment @@ -719,10 +719,10 @@ index 7ee7ed5de..6dbc5a1bf 100644 2.42.0 -From e8c55c05618756cf090470c355f2864dafe0a618 Mon Sep 17 00:00:00 2001 +From 4a03369ce3240bc6d517059071d91760ee6224e4 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 31 May 2023 13:58:44 +0200 -Subject: [PATCH 05/16] sched/fair: Implement an EEVDF-like scheduling policy +Subject: [PATCH 05/17] sched/fair: Implement an EEVDF-like scheduling policy Where CFS is currently a WFQ based scheduler with only a single knob, the weight. The addition of a second, latency oriented parameter, @@ -1398,10 +1398,10 @@ index 4ccb73d85..1fc81dd7f 100644 2.42.0 -From 6aa7145ce28656863846e7f67ad98e3ed89473f3 Mon Sep 17 00:00:00 2001 +From 449a35d8af95c27bed6e2b3953dec01a8617c68e Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 31 May 2023 13:58:45 +0200 -Subject: [PATCH 06/16] sched/fair: Commit to lag based placement +Subject: [PATCH 06/17] sched/fair: Commit to lag based placement Removes the FAIR_SLEEPERS code in favour of the new LAG based placement. @@ -1526,10 +1526,10 @@ index 60cce1e6f..2a830eccd 100644 2.42.0 -From 12c67a50f08fe4b97fda8f13302e2574e10351c7 Mon Sep 17 00:00:00 2001 +From 0d15fadb3b9277144df12a3f1af2bd9e868e4d63 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 31 May 2023 13:58:46 +0200 -Subject: [PATCH 07/16] sched/smp: Use lag to simplify cross-runqueue placement +Subject: [PATCH 07/17] sched/smp: Use lag to simplify cross-runqueue placement Using lag is both more correct and simpler when moving between runqueues. @@ -1793,10 +1793,10 @@ index 91f25d6c8..b7daccfb2 100644 2.42.0 -From 8e2fcd5cb320987439faec8442f7f73ccb234875 Mon Sep 17 00:00:00 2001 +From 42396c41c6120cdeb72480c3af02ec4876c50d82 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 31 May 2023 13:58:47 +0200 -Subject: [PATCH 08/16] sched/fair: Commit to EEVDF +Subject: [PATCH 08/17] sched/fair: Commit to EEVDF EEVDF is a better defined scheduling policy, as a result it has less heuristics/tunables. There is no compelling reason to keep CFS around. @@ -2569,10 +2569,10 @@ index 1fc81dd7f..83bbcd35c 100644 2.42.0 -From 55aa8349238fbe34a1f8198d56210a5e773851f1 Mon Sep 17 00:00:00 2001 +From 08697aba12aedc549b68fa7d45302466114462ab Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 31 May 2023 13:58:48 +0200 -Subject: [PATCH 09/16] sched/debug: Rename sysctl_sched_min_granularity to +Subject: [PATCH 09/17] sched/debug: Rename sysctl_sched_min_granularity to sysctl_sched_base_slice EEVDF uses this tunable as the base request/slice -- make sure the @@ -2685,10 +2685,10 @@ index 83bbcd35c..e21f6a048 100644 2.42.0 -From d059ffad9f9729ec63ad32fc3840a1a308cbd8a7 Mon Sep 17 00:00:00 2001 +From a7c65d5f4a52a536b4df4272895b70febf77238b Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 31 May 2023 13:58:49 +0200 -Subject: [PATCH 10/16] sched/fair: Propagate enqueue flags into place_entity() +Subject: [PATCH 10/17] sched/fair: Propagate enqueue flags into place_entity() This allows place_entity() to consider ENQUEUE_WAKEUP and ENQUEUE_MIGRATED. @@ -2766,10 +2766,10 @@ index e21f6a048..576d371c8 100644 2.42.0 -From 80cdbd469974a44e5150be88f5c696ec241f6087 Mon Sep 17 00:00:00 2001 +From e31e544605b41e66131d6b63b24b3ce1f377d866 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 16 Aug 2023 15:40:59 +0200 -Subject: [PATCH 11/16] sched/eevdf: Curb wakeup-preemption +Subject: [PATCH 11/17] sched/eevdf: Curb wakeup-preemption Mike and others noticed that EEVDF does like to over-schedule quite a bit -- which does hurt performance of a number of benchmarks / @@ -2858,10 +2858,10 @@ index 54334ca5c..546d212ef 100644 2.42.0 -From 7d5bf4ed3cc74835a55db18eead11af61557a795 Mon Sep 17 00:00:00 2001 +From 9307eff09160b7f12e27112a0ed5d4723f2767c2 Mon Sep 17 00:00:00 2001 From: Shrikanth Hegde Date: Thu, 24 Aug 2023 13:33:42 +0530 -Subject: [PATCH 12/16] sched/eevdf/doc: Modify the documented knob to +Subject: [PATCH 12/17] sched/eevdf/doc: Modify the documented knob to base_slice_ns as well After committing the scheduler to EEVDF, we renamed the 'min_granularity_ns' @@ -2897,10 +2897,10 @@ index 03db55504..f68919800 100644 2.42.0 -From bff784de63e9a8567d91b630e8f2bf842aef894b Mon Sep 17 00:00:00 2001 +From 27413005ea70c604267673df79f14296c2ae4eae Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Fri, 15 Sep 2023 00:48:55 +0200 -Subject: [PATCH 13/16] sched/eevdf: Also update slice on placement +Subject: [PATCH 13/17] sched/eevdf: Also update slice on placement Tasks that never consume their full slice would not update their slice value. This means that tasks that are spawned before the sysctl scaling keep their @@ -2936,10 +2936,10 @@ index 1cdc95725..efbcdc69c 100644 2.42.0 -From 163619e41993d6e481a745466c05cc0dfb3dcda8 Mon Sep 17 00:00:00 2001 +From f38ec3c65aa3ae0971c65c0968033391d3c8cae6 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Tue, 26 Sep 2023 14:29:50 +0200 -Subject: [PATCH 14/16] sched/eevdf: Fix avg_vruntime() +Subject: [PATCH 14/17] sched/eevdf: Fix avg_vruntime() The expectation is that placing a task at avg_vruntime() makes it eligible. Turns out there is a corner case where this is not the case. @@ -2991,10 +2991,10 @@ index efbcdc69c..9dbf3ce61 100644 2.42.0 -From 217895647edb558ce9b28d0e07418f66fdaf85bc Mon Sep 17 00:00:00 2001 +From 38ee54edf4535b987660980eba5dede6f0cb5c4b Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Fri, 6 Oct 2023 21:24:45 +0200 -Subject: [PATCH 15/16] sched/eevdf: Fix min_deadline heap integrity +Subject: [PATCH 15/17] sched/eevdf: Fix min_deadline heap integrity Marek and Biju reported instances of: @@ -3044,10 +3044,10 @@ index 9dbf3ce61..a0f1d9578 100644 2.42.0 -From 71f1c08f8102e48a5235bb145af59edfa597cf72 Mon Sep 17 00:00:00 2001 +From f183a7a169faad61743f1a3068529dd73fcfc936 Mon Sep 17 00:00:00 2001 From: Benjamin Segall Date: Fri, 29 Sep 2023 17:09:30 -0700 -Subject: [PATCH 16/16] sched/eevdf: Fix pick_eevdf() +Subject: [PATCH 16/17] sched/eevdf: Fix pick_eevdf() The old pick_eevdf() could fail to find the actual earliest eligible deadline when it descended to the right looking for min_deadline, but @@ -3192,3 +3192,36 @@ index a0f1d9578..caec9b43c 100644 -- 2.42.0 + +From 07a48d2365d2d9739be3de2172b5c9ecc5ef867e Mon Sep 17 00:00:00 2001 +From: Peter Zijlstra +Date: Tue, 17 Oct 2023 16:59:47 +0200 +Subject: [PATCH 17/17] sched/eevdf: Fix heap corruption more + +Because someone is a flaming idiot... :/ + +Fixes: 8dafa9d0eb1a ("sched/eevdf: Fix min_deadline heap integrity") +Reported-by: 0599jiangyc@gmail.com +Signed-off-by: Peter Zijlstra (Intel) +Link: https://bugzilla.kernel.org/show_bug.cgi?id=218020 +--- + kernel/sched/fair.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c +index caec9b43c..d0d912960 100644 +--- a/kernel/sched/fair.c ++++ b/kernel/sched/fair.c +@@ -3656,7 +3656,8 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, + */ + deadline = div_s64(deadline * old_weight, weight); + se->deadline = se->vruntime + deadline; +- min_deadline_cb_propagate(&se->run_node, NULL); ++ if (se != cfs_rq->curr) ++ min_deadline_cb_propagate(&se->run_node, NULL); + } + + #ifdef CONFIG_SMP +-- +2.42.0 +