[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1586867796-5768-3-git-send-email-wangqing@vivo.com>
Date: Tue, 14 Apr 2020 20:36:31 +0800
From: Wang Qing <wangqing@...o.com>
To: Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
James Morse <james.morse@....com>,
Mark Rutland <mark.rutland@....com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Thomas Gleixner <tglx@...utronix.de>,
jinho lim <jordan.lim@...sung.com>,
Wang Qing <wangqing@...o.com>,
Dave Martin <Dave.Martin@....com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: opensource.kernel@...o.com
Subject: [V3 2/3] sched:add task_running()
The task_running() should be renamed to task_running_on_rq()
like the naming of task_running_on_cpu(), this is what it
originally mean.
Add task_running() no rq required.
Signed-off-by: Wang Qing <wangqing@...o.com>
---
include/linux/sched.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4418f5c..0a7b150 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1843,6 +1843,11 @@ static inline unsigned int task_cpu(const struct task_struct *p)
extern void set_task_cpu(struct task_struct *p, unsigned int cpu);
+static inline int task_running(const struct task_struct *p)
+{
+ return READ_ONCE(p->on_cpu);
+}
+
#else
static inline unsigned int task_cpu(const struct task_struct *p)
@@ -1854,6 +1859,11 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
{
}
+static inline int task_running(const struct task_struct *p)
+{
+ return p == current;
+}
+
#endif /* CONFIG_SMP */
/*
--
2.7.4
Powered by blists - more mailing lists