From: Steven Rostedt <rostedt@goodmis.org>
To: Kirill Tkhai <tkhai@yandex.ru>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Juri Lelli <juri.lelli@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>
Subject: Re: [RFC] sched/deadline: Prevent rt_time growth to infinity
Date: Thu, 20 Feb 2014 16:22:39 -0500 [thread overview]
Message-ID: <20140220162239.3efe86a7@gandalf.local.home> (raw)
In-Reply-To: <230991392848160@web13m.yandex.ru>
Peter, Juri,
Have you seen this?
-- Steve
On Thu, 20 Feb 2014 02:16:00 +0400
Kirill Tkhai <tkhai@yandex.ru> wrote:
> Since deadline tasks share rt bandwidth, we must care about
> bandwidth timer set. Otherwise rt_time may grow up to infinity
> in update_curr_dl(), if there are no other available RT tasks
> on top level bandwidth.
>
> I'm going to decide the problem the way below. Almost untested
> because of I skipped almost all of recent patches which haveto be applied from lkml.
>
> Please say, if I skipped anything in idea. Maybe better put
> start_top_rt_bandwidth() into set_curr_task_dl()?
>
> ---
> kernel/sched/deadline.c | 1 +
> kernel/sched/rt.c | 16 +++++++++++++++-
> kernel/sched/sched.h | 1 +
> 3 files changed, 17 insertions(+), 1 deletion(-)
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index ed31ef6..f1d2304 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -720,6 +720,7 @@ void inc_dl_tasks(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq)
>
> inc_dl_deadline(dl_rq, deadline);
> inc_dl_migration(dl_se, dl_rq);
> + start_top_rt_bandwidth(rq_of_dl_rq(dl_rq));
> }
>
> static inline
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 72f9ec7..a187eb8 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -726,7 +726,7 @@ static inline int balance_runtime(struct rt_rq *rt_rq)
>
> static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
> {
> - int i, idle = 1, throttled = 0;
> + int i, idle = 1, throttled = 0, has_dl_tasks = 0;
> const struct cpumask *span;
>
> span = sched_rt_period_mask();
> @@ -781,9 +781,15 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
>
> if (enqueue)
> sched_rt_rq_enqueue(rt_rq);
> +
> + if (rt_rq == &rq->rt && rq->dl.dl_nr_running)
> + has_dl_tasks = 1;
> raw_spin_unlock(&rq->lock);
> }
>
> + if (has_dl_tasks)
> + return 0;
> +
> if (!throttled && (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF))
> return 1;
>
> @@ -1005,6 +1011,10 @@ dec_rt_group(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
> WARN_ON(!rt_rq->rt_nr_running && rt_rq->rt_nr_boosted);
> }
>
> +void start_top_rt_bandwidth(struct rq *rq)
> +{
> + start_rt_bandwidth(&rq->rt.tg->rt_bandwidth);
> +}
> #else /* CONFIG_RT_GROUP_SCHED */
>
> static void
> @@ -1016,6 +1026,10 @@ inc_rt_group(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
> static inline
> void dec_rt_group(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) {}
>
> +void start_top_rt_bandwidth(struct rq *rq)
> +{
> + start_rt_bandwidth(&def_rt_bandwidth);
> +}
> #endif /* CONFIG_RT_GROUP_SCHED */
>
> static inline
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 1bf34c2..a20f8f7 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -1294,6 +1294,7 @@ static inline void sched_avg_update(struct rq *rq) { }
> #endif
>
> extern void start_bandwidth_timer(struct hrtimer *period_timer, ktime_t period);
> +extern void start_top_rt_bandwidth(struct rq *rq);
>
> #ifdef CONFIG_SMP
> #ifdef CONFIG_PREEMPT
next prev parent reply other threads:[~2014-02-20 21:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 22:16 Kirill Tkhai
2014-02-20 21:22 ` Steven Rostedt [this message]
2014-02-21 10:37 ` Peter Zijlstra
2014-02-21 11:33 ` Kirill Tkhai
2014-02-21 12:09 ` Kirill Tkhai
2014-02-21 12:44 ` Juri Lelli
2014-02-21 14:25 ` Kirill Tkhai
2014-02-21 16:36 ` Juri Lelli
2014-02-21 16:53 ` Juri Lelli
2014-02-21 23:50 ` Kirill Tkhai
2014-02-22 0:56 ` Kirill Tkhai
2014-02-25 14:15 ` Juri Lelli
2014-02-25 14:58 ` Kirill Tkhai
2014-02-27 13:32 ` [tip:sched/urgent] " tip-bot for Juri Lelli
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=20140220162239.3efe86a7@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=juri.lelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tkhai@yandex.ru \
/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
all inboxes | Powered by JetHome®