sched: Use task_current() instead of 'rq->curr == p'
authorHui Su <sh_def@163.com>
Fri, 30 Oct 2020 17:32:23 +0000 (01:32 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 14 Jan 2021 10:20:11 +0000 (11:20 +0100)
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
kernel/sched/deadline.c
kernel/sched/debug.c
kernel/sched/fair.c
kernel/sched/rt.c

index 75686c6d4436d2b187de24391edb2bdbeda772c1..5421782fe89771febf31303931db2bb1a7b1b19d 100644 (file)
@@ -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,
                            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
index 2357921580f9c052ec49094f93a20ea3bf969d53..486f403a778b2201942c66771a00beaaaf7fa3e0 100644 (file)
@@ -486,7 +486,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));
index 53802b77ce641bb877d7c5a6c2de3150fb2b4619..197a51473e0c430cb020e1e0cb28a6d620d47ba2 100644 (file)
@@ -5430,7 +5430,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;
                }
@@ -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
         * 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
@@ -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
                 * 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);
index dbe4629cf7ba46211746531a2fd72c3ec11f1970..8f720b71d13dd3f4a3d65c325701ae8d4e85d868 100644 (file)
@@ -2357,7 +2357,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