From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Subject: what is the need for task_rq in setscheduler?
Date: Thu, 18 Nov 2004 23:13:36 -0500 [thread overview]
Message-ID: <1100837616.4051.17.camel@localhost.localdomain> (raw)
I'm curious to the need for the task_rq in setscheduler in the following
code:
3316 rq = task_rq_lock(p, &flags);
3317 /* recheck policy now with rq lock held */
3318 if (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) {
3319 policy = oldpolicy = -1;
3320 task_rq_unlock(rq, &flags);
3321 goto recheck;
3322 }
3323 array = p->array;
3324 if (array)
3325 deactivate_task(p, task_rq(p));
3326 retval = 0;
3327 oldprio = p->prio;
3328 __setscheduler(p, policy, lp.sched_priority);
3329 if (array) {
3330 __activate_task(p, task_rq(p));
3331 /*
3332 * Reschedule if we are currently running on this runqueue and
3333 * our priority decreased, or if we are not currently running on
3334 * this runqueue and our priority is higher than the current's
3335 */
3336 if (task_running(rq, p)) {
3337 if (p->prio > oldprio)
3338 resched_task(rq->curr);
3339 } else if (TASK_PREEMPTS_CURR(p, rq))
3340 resched_task(rq->curr);
3341 }
3342 task_rq_unlock(rq, &flags);
On lines 3325 and 3330 with the calls to deactivate_task and
__activate_task respectively. The runqueue is locked at 3316. Can the
runqueue returned by task_rq change in this setup? If not, what is the
need for the call to task_rq. Can't rq just be used instead, or is this
just some extra paranoia?
Thanks,
-- Steve
next reply other threads:[~2004-11-19 4:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-19 4:13 Steven Rostedt [this message]
2004-11-19 4:39 ` [patch] no need to recalculate rq Robert Love
2004-11-19 9:51 ` Ingo Molnar
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=1100837616.4051.17.camel@localhost.localdomain \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).