[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <161858842081.29796.1137333756957597015.tip-bot2@tip-bot2>
Date: Fri, 16 Apr 2021 15:53:40 -0000
From: "tip-bot2 for Peter Zijlstra" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: "Peter Zijlstra (Intel)" <peterz@...radead.org>,
Valentin Schneider <valentin.schneider@....com>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: sched/core] sched,fair: Alternative sched_slice()
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 0c2de3f054a59f15e01804b75a04355c48de628c
Gitweb: https://git.kernel.org/tip/0c2de3f054a59f15e01804b75a04355c48de628c
Author: Peter Zijlstra <peterz@...radead.org>
AuthorDate: Thu, 25 Mar 2021 13:44:46 +01:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Fri, 16 Apr 2021 17:06:35 +02:00
sched,fair: Alternative sched_slice()
The current sched_slice() seems to have issues; there's two possible
things that could be improved:
- the 'nr_running' used for __sched_period() is daft when cgroups are
considered. Using the RQ wide h_nr_running seems like a much more
consistent number.
- (esp) cgroups can slice it real fine, which makes for easy
over-scheduling, ensure min_gran is what the name says.
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Tested-by: Valentin Schneider <valentin.schneider@....com>
Link: https://lkml.kernel.org/r/20210412102001.611897312@infradead.org
---
kernel/sched/fair.c | 12 +++++++++++-
kernel/sched/features.h | 3 +++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b3ea14c..49636a4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -687,7 +687,13 @@ static u64 __sched_period(unsigned long nr_running)
*/
static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
{
- u64 slice = __sched_period(cfs_rq->nr_running + !se->on_rq);
+ unsigned int nr_running = cfs_rq->nr_running;
+ u64 slice;
+
+ if (sched_feat(ALT_PERIOD))
+ nr_running = rq_of(cfs_rq)->cfs.h_nr_running;
+
+ slice = __sched_period(nr_running + !se->on_rq);
for_each_sched_entity(se) {
struct load_weight *load;
@@ -704,6 +710,10 @@ static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
}
slice = __calc_delta(slice, se->load.weight, load);
}
+
+ if (sched_feat(BASE_SLICE))
+ slice = max(slice, (u64)sysctl_sched_min_granularity);
+
return slice;
}
diff --git a/kernel/sched/features.h b/kernel/sched/features.h
index 422fa68..011c5ec 100644
--- a/kernel/sched/features.h
+++ b/kernel/sched/features.h
@@ -90,3 +90,6 @@ SCHED_FEAT(WA_BIAS, true)
*/
SCHED_FEAT(UTIL_EST, true)
SCHED_FEAT(UTIL_EST_FASTUP, true)
+
+SCHED_FEAT(ALT_PERIOD, true)
+SCHED_FEAT(BASE_SLICE, true)
Powered by blists - more mailing lists