From: Juri Lelli <juri.lelli@arm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: peterz@infradead.org, linux-kernel@vger.kernel.org,
mingo@redhat.com, luca.abeni@unitn.it, xpang@redhat.com
Subject: Re: [PATCH v5] sched/deadline: remove useless param from setup_new_dl_entity
Date: Fri, 5 Aug 2016 15:34:44 +0100 [thread overview]
Message-ID: <20160805143444.GH28125@e106622-lin> (raw)
In-Reply-To: <20160805095643.130194cf@gandalf.local.home>
On 05/08/16 09:56, Steven Rostedt wrote:
> On Fri, 5 Aug 2016 11:09:59 +0100
> Juri Lelli <juri.lelli@arm.com> wrote:
>
> > @@ -1720,19 +1720,28 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
> > */
> > static void switched_to_dl(struct rq *rq, struct task_struct *p)
> > {
> > - if (dl_time_before(p->dl.deadline, rq_clock(rq)))
> > - setup_new_dl_entity(&p->dl, &p->dl);
> >
> > - if (task_on_rq_queued(p) && rq->curr != p) {
> > + if (task_on_rq_queued(p)) {
>
> I always hated functions totally encapsulated by an if statement. This
> can be a bit simpler (and less indented) if you have:
>
> /* If p is not queued, its parameters will be updated at wakeup */
> if (!task_on_rq_queued(p))
> return;
>
> [...]
>
You mean like what follows?
I'll post a v6 if OK.
Thanks,
- Juri
--->8---
kernel/sched/deadline.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 9491dbe039e8..03f35f66cf1f 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1721,27 +1721,28 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p)
static void switched_to_dl(struct rq *rq, struct task_struct *p)
{
- if (task_on_rq_queued(p)) {
- /*
- * If p is not queued we will update its parameters at next
- * wakeup. If p is dl_boosted we already updated its params in
- * rt_mutex_setprio()->enqueue_task(..., ENQUEUE_REPLENISH),
- * p's deadline being now already after rq_clock(rq).
- */
- if (dl_time_before(p->dl.deadline, rq_clock(rq)))
- setup_new_dl_entity(&p->dl);
+ /* If p is not queued we will update its parameters at next wakeup. */
+ if (!task_on_rq_queued(p))
+ return;
+
+ /*
+ * If p is boosted we already updated its params in
+ * rt_mutex_setprio()->enqueue_task(..., ENQUEUE_REPLENISH),
+ * p's deadline being now already after rq_clock(rq).
+ */
+ if (dl_time_before(p->dl.deadline, rq_clock(rq)))
+ setup_new_dl_entity(&p->dl);
- if (rq->curr != p) {
+ if (rq->curr != p) {
#ifdef CONFIG_SMP
- if (tsk_nr_cpus_allowed(p) > 1 && rq->dl.overloaded)
- queue_push_tasks(rq);
+ if (tsk_nr_cpus_allowed(p) > 1 && rq->dl.overloaded)
+ queue_push_tasks(rq);
#else
- if (dl_task(rq->curr))
- check_preempt_curr_dl(rq, p, 0);
- else
- resched_curr(rq);
+ if (dl_task(rq->curr))
+ check_preempt_curr_dl(rq, p, 0);
+ else
+ resched_curr(rq);
#endif
- }
}
}
next prev parent reply other threads:[~2016-08-05 14:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-05 10:09 Juri Lelli
2016-08-05 12:41 ` Xunlei Pang
2016-08-05 13:56 ` Steven Rostedt
2016-08-05 14:34 ` Juri Lelli [this message]
2016-08-05 14:54 ` Steven Rostedt
2016-08-05 15:02 ` 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=20160805143444.GH28125@e106622-lin \
--to=juri.lelli@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@unitn.it \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=xpang@redhat.com \
/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®