Commit 65bcf072 authored by Hui Su's avatar Hui Su Committed by Peter Zijlstra

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

Use the task_current() function where appropriate.

No functional change.
Signed-off-by: default avatarHui Su <sh_def@163.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Link: https://lkml.kernel.org/r/20201030173223.GA52339@rlk
parent e9b9734b
...@@ -2514,7 +2514,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p) ...@@ -2514,7 +2514,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, static void prio_changed_dl(struct rq *rq, struct task_struct *p,
int oldprio) int oldprio)
{ {
if (task_on_rq_queued(p) || rq->curr == p) { if (task_on_rq_queued(p) || task_current(rq, p)) {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* /*
* This might be too much, but unfortunately * This might be too much, but unfortunately
......
...@@ -486,7 +486,7 @@ static char *task_group_path(struct task_group *tg) ...@@ -486,7 +486,7 @@ static char *task_group_path(struct task_group *tg)
static void static void
print_task(struct seq_file *m, struct rq *rq, struct task_struct *p) 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"); SEQ_printf(m, ">R");
else else
SEQ_printf(m, " %c", task_state_to_char(p)); SEQ_printf(m, " %c", task_state_to_char(p));
......
...@@ -5430,7 +5430,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p) ...@@ -5430,7 +5430,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p)
s64 delta = slice - ran; s64 delta = slice - ran;
if (delta < 0) { if (delta < 0) {
if (rq->curr == p) if (task_current(rq, p))
resched_curr(rq); resched_curr(rq);
return; return;
} }
...@@ -10829,7 +10829,7 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio) ...@@ -10829,7 +10829,7 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio)
* our priority decreased, or if we are not currently running on * our priority decreased, or if we are not currently running on
* this runqueue and our priority is higher than the current's * this runqueue and our priority is higher than the current's
*/ */
if (rq->curr == p) { if (task_current(rq, p)) {
if (p->prio > oldprio) if (p->prio > oldprio)
resched_curr(rq); resched_curr(rq);
} else } else
...@@ -10962,7 +10962,7 @@ static void switched_to_fair(struct rq *rq, struct task_struct *p) ...@@ -10962,7 +10962,7 @@ static void switched_to_fair(struct rq *rq, struct task_struct *p)
* kick off the schedule if running, otherwise just see * kick off the schedule if running, otherwise just see
* if we can still preempt the current task. * if we can still preempt the current task.
*/ */
if (rq->curr == p) if (task_current(rq, p))
resched_curr(rq); resched_curr(rq);
else else
check_preempt_curr(rq, p, 0); check_preempt_curr(rq, p, 0);
......
...@@ -2357,7 +2357,7 @@ prio_changed_rt(struct rq *rq, struct task_struct *p, int oldprio) ...@@ -2357,7 +2357,7 @@ prio_changed_rt(struct rq *rq, struct task_struct *p, int oldprio)
if (!task_on_rq_queued(p)) if (!task_on_rq_queued(p))
return; return;
if (rq->curr == p) { if (task_current(rq, p)) {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* /*
* If our priority decreases while running, we * If our priority decreases while running, we
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment