Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1607856
| From | luca abeni <luca.abeni@santannapisa.it> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC v5 8/9] sched/deadline: base GRUB reclaiming on the inactive utilization |
| Date | 2017-03-23 21:00 +0100 |
| Message-ID | <toh3P-72e-13@gated-at.bofh.it> (permalink) |
| References | <toh3P-72e-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Luca Abeni <luca.abeni@santannapisa.it>
Instead of decreasing the runtime as "dq = -Uact dt" (eventually
divided by the maximum utilization available for deadline tasks),
decrease it as "dq = -(1 - Uinact) dt", where Uinact is the "inactive
utilization".
In this way, the maximum fraction of CPU time that can be reclaimed
is given by the total utilization of deadline tasks.
This approach solves some fairness issues that have been noticed with
"traditional" global GRUB reclaiming.
Signed-off-by: Luca Abeni <luca.abeni@santannapisa.it>
Tested-by: Daniel Bristot de Oliveira <bristot@redhat.com>
---
kernel/sched/deadline.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index d70a7b9..c393c3d 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -900,14 +900,23 @@ extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq);
/*
* This function implements the GRUB accounting rule:
* according to the GRUB reclaiming algorithm, the runtime is
- * not decreased as "dq = -dt", but as "dq = -Uact dt", where
- * Uact is the (per-runqueue) active utilization.
- * Since rq->dl.running_bw contains Uact * 2^20, the result
- * has to be shifted right by 20.
+ * not decreased as "dq = -dt", but as "dq = (1 - Uinact) dt", where
+ * Uinact is the (per-runqueue) inactive utilization, computed as the
+ * difference between the "total runqueue utilization" and the runqueue
+ * active utilization.
+ * Since rq->dl.running_bw and rq->dl.this_bw contain utilizations
+ * multiplied by 2^20, the result has to be shifted right by 20.
*/
-u64 grub_reclaim(u64 delta, struct rq *rq)
+u64 grub_reclaim(u64 delta, struct rq *rq, u64 u)
{
- return (delta * rq->dl.running_bw * rq->dl.deadline_bw_inv) >> 20 >> 8;
+ u64 u_act;
+
+ if (rq->dl.this_bw - rq->dl.running_bw > (1 << 20) - u)
+ u_act = u;
+ else
+ u_act = (1 << 20) - rq->dl.this_bw + rq->dl.running_bw;
+
+ return (delta * u_act) >> 20;
}
/*
@@ -953,7 +962,7 @@ static void update_curr_dl(struct rq *rq)
sched_rt_avg_update(rq, delta_exec);
if (unlikely(dl_se->flags & SCHED_FLAG_RECLAIM))
- delta_exec = grub_reclaim(delta_exec, rq);
+ delta_exec = grub_reclaim(delta_exec, rq, curr->dl.dl_bw);
dl_se->runtime -= delta_exec;
throttle:
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC v5 0/9] CPU reclaiming for SCHED_DEADLINE luca abeni <luca.abeni@santannapisa.it> - 2017-03-23 21:00 +0100
[RFC v5 8/9] sched/deadline: base GRUB reclaiming on the inactive utilization luca abeni <luca.abeni@santannapisa.it> - 2017-03-23 21:00 +0100
Re: [RFC v5 8/9] sched/deadline: base GRUB reclaiming on the inactive utilization Peter Zijlstra <peterz@infradead.org> - 2017-03-27 16:30 +0200
Re: [RFC v5 8/9] sched/deadline: base GRUB reclaiming on the inactive utilization Luca Abeni <luca.abeni@santannapisa.it> - 2017-03-27 17:00 +0200
Re: [RFC v5 8/9] sched/deadline: base GRUB reclaiming on the inactive utilization Peter Zijlstra <peterz@infradead.org> - 2017-03-27 18:20 +0200
Re: [RFC v5 8/9] sched/deadline: base GRUB reclaiming on the inactive utilization luca abeni <luca.abeni@santannapisa.it> - 2017-03-27 19:10 +0200
[RFC v5 2/9] sched/deadline: improve the tracking of active utilization luca abeni <luca.abeni@santannapisa.it> - 2017-03-23 21:00 +0100
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization Peter Zijlstra <peterz@infradead.org> - 2017-03-24 14:30 +0100
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization Peter Zijlstra <peterz@infradead.org> - 2017-03-24 14:30 +0100
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization luca abeni <luca.abeni@santannapisa.it> - 2017-03-24 22:50 +0100
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization Steven Rostedt <rostedt@goodmis.org> - 2017-03-25 03:40 +0100
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization Luca Abeni <luca.abeni@santannapisa.it> - 2017-03-27 10:30 +0200
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization Claudio Scordino <claudio@evidence.eu.com> - 2017-03-27 11:00 +0200
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization Juri Lelli <juri.lelli@arm.com> - 2017-03-27 09:20 +0200
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization Luca Abeni <luca.abeni@santannapisa.it> - 2017-03-27 10:10 +0200
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization Juri Lelli <juri.lelli@arm.com> - 2017-03-27 10:50 +0200
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization Luca Abeni <luca.abeni@santannapisa.it> - 2017-03-27 09:40 +0200
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization Mathieu Poirier <mathieu.poirier@linaro.org> - 2017-03-26 19:40 +0200
Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization luca abeni <luca.abeni@santannapisa.it> - 2017-03-26 23:10 +0200
[RFC v5 6/9] sched/deadline: make GRUB a task's flag luca abeni <luca.abeni@santannapisa.it> - 2017-03-23 21:00 +0100
[RFC v5 7/9] sched/deadline: track the "total rq utilization" too luca abeni <luca.abeni@santannapisa.it> - 2017-03-23 21:00 +0100
[RFC v5 4/9] sched/deadline: implement GRUB accounting luca abeni <luca.abeni@santannapisa.it> - 2017-03-23 21:00 +0100
[RFC v5 3/9] sched/deadline: fix the update of the total -deadline utilization luca abeni <luca.abeni@santannapisa.it> - 2017-03-23 21:00 +0100
csiph-web