From: Byungchul Park <byungchul.park@lge.com>
To: Juri Lelli <juri.lelli@arm.com>
Cc: peterz@infradead.org, mingo@kernel.org,
linux-kernel@vger.kernel.org, juri.lelli@gmail.com,
rostedt@goodmis.org, kernel-team@lge.com
Subject: Re: [PATCH v3] sched/deadline: Change the time to replenish runtime for sleep tasks
Date: Tue, 28 Feb 2017 22:09:03 +0900 [thread overview]
Message-ID: <20170228130903.GF3817@X58A-UD3R> (raw)
In-Reply-To: <20170228113515.GM19665@e106622-lin>
On Tue, Feb 28, 2017 at 11:35:15AM +0000, Juri Lelli wrote:
> Hi,
>
> On 23/02/17 15:14, Byungchul Park wrote:
> > Let's consider the following example.
> >
> > timeline : o...................o.........o.......o..o
> > ^ ^ ^ ^ ^
> > | | | | |
> > start | | | |
> > original runtime | | |
> > sleep with (-)runtime | |
> > original deadline |
> > wake up
> >
> > When this task is woken up, a negative runtime should be considered,
> > which means that the task should get penalized when assigning runtime,
> > becasue it already spent more than expected. Current code handles this
> > by replenishing a runtime in hrtimer callback for deadline. But this
> > approach has room for improvement:
> >
> > It will be replenished twice unnecessarily if the task sleeps for
> > long time so that the deadline, assigned in the hrtimer callback,
> > also passed. In other words, one happens in the callback and the
> > other happens in update_dl_entiry() when waking it up.
> >
> > So force to replenish it for sleep tasks when waking it up.
> >
> > Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> > ---
> > kernel/sched/deadline.c | 13 ++++++-------
> > 1 file changed, 6 insertions(+), 7 deletions(-)
> >
> > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> > index 27737f3..cb43ce9 100644
> > --- a/kernel/sched/deadline.c
> > +++ b/kernel/sched/deadline.c
> > @@ -498,8 +498,9 @@ static void update_dl_entity(struct sched_dl_entity *dl_se,
> > struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
> > struct rq *rq = rq_of_dl_rq(dl_rq);
> >
> > - if (dl_time_before(dl_se->deadline, rq_clock(rq)) ||
> > - dl_entity_overflow(dl_se, pi_se, rq_clock(rq))) {
> > + if (dl_time_before(dl_se->deadline, rq_clock(rq)))
> > + replenish_dl_entity(dl_se, pi_se);
> > + else if (dl_entity_overflow(dl_se, pi_se, rq_clock(rq))) {
> > dl_se->deadline = rq_clock(rq) + pi_se->dl_deadline;
> > dl_se->runtime = pi_se->dl_runtime;
> > }
> > @@ -621,13 +622,11 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer)
> > * __dequeue_task_dl()
> > * prev->on_rq = 0;
> > *
> > - * We can be both throttled and !queued. Replenish the counter
> > - * but do not enqueue -- wait for our wakeup to do that.
> > + * We can be both throttled and !queued. Wait for our wakeup to
> > + * replenish runtime and enqueue p.
> > */
> > - if (!task_on_rq_queued(p)) {
> > - replenish_dl_entity(dl_se, dl_se);
>
> Hasn't this patch the same problem we discussed a couple of weeks ago?
No. This patch solves the problem by calling replenish_dl_entity() when
a dl task is woken up.
The problem was that it cannot consider negative runtime if we replenish
the task when it's woken up. So I made replenish_dl_entity() called even
on wake-up path, instead of simple assignment.
IMHO, this patch avoids double-replenishing properly, but adds additional
condition on wake-up path to acheive it. To be honest, I don't think it's
worth as I expected.
Thank you,
Byungchul
>
> https://marc.info/?l=linux-kernel&m=148699950802995
>
> Thanks,
>
> - Juri
next prev parent reply other threads:[~2017-02-28 13:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-23 6:14 [PATCH v3] sched/deadline: Change the time to replenish runtime for sleep tasks Byungchul Park
2017-02-23 10:11 ` Byungchul Park
2017-02-28 11:35 ` Juri Lelli
2017-02-28 13:09 ` Byungchul Park [this message]
2017-02-28 17:47 ` Juri Lelli
2017-03-01 3:37 ` Byungchul Park
2017-03-01 9:59 ` Juri Lelli
2017-03-01 12:09 ` Byungchul Park
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=20170228130903.GF3817@X58A-UD3R \
--to=byungchul.park@lge.com \
--cc=juri.lelli@arm.com \
--cc=juri.lelli@gmail.com \
--cc=kernel-team@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/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