sched: Use task_current() instead of 'rq->curr == p'

Use the task_current() function where appropriate.

No functional change.

Signed-off-by: Hui Su <sh_def@163.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Link: https://lkml.kernel.org/r/20201030173223.GA52339@rlk
Signed-off-by: azrim <mirzaspc@gmail.com>
This commit is contained in:
Hui Su 2020-10-31 01:32:23 +08:00 committed by azrim
parent a4209ae846
commit c660f076b1
No known key found for this signature in database
GPG Key ID: 497F8FB059B45D1C
4 changed files with 6 additions and 6 deletions

View File

@ -2359,7 +2359,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
static void prio_changed_dl(struct rq *rq, struct task_struct *p,
int oldprio)
{
if (task_on_rq_queued(p) || rq->curr == p) {
if (task_on_rq_queued(p) || task_current(rq, p)) {
#ifdef CONFIG_SMP
/*
* This might be too much, but unfortunately

View File

@ -536,7 +536,7 @@ static char *task_group_path(struct task_group *tg)
static void
print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
{
if (rq->curr == p)
if (task_current(rq, p))
SEQ_printf(m, ">R");
else
SEQ_printf(m, " %c", task_state_to_char(p));

View File

@ -5191,7 +5191,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p)
s64 delta = slice - ran;
if (delta < 0) {
if (rq->curr == p)
if (task_current(rq, p))
resched_curr(rq);
return;
}
@ -12358,7 +12358,7 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio)
* our priority decreased, or if we are not currently running on
* this runqueue and our priority is higher than the current's
*/
if (rq->curr == p) {
if (task_current(rq, p)) {
if (p->prio > oldprio)
resched_curr(rq);
} else
@ -12491,7 +12491,7 @@ static void switched_to_fair(struct rq *rq, struct task_struct *p)
* kick off the schedule if running, otherwise just see
* if we can still preempt the current task.
*/
if (rq->curr == p)
if (task_current(rq, p))
resched_curr(rq);
else
check_preempt_curr(rq, p, 0);

View File

@ -2498,7 +2498,7 @@ prio_changed_rt(struct rq *rq, struct task_struct *p, int oldprio)
if (!task_on_rq_queued(p))
return;
if (rq->curr == p) {
if (task_current(rq, p)) {
#ifdef CONFIG_SMP
/*
* If our priority decreases while running, we