sched: Change task_curr return type to bool
PATCH 1/1 sched: Change task_curr return type to bool
Modified task_curr to return a bool instead of int for clarity and better semantic alignment.
Signed-off-by Zhan Xusheng <[email protected]>
--- include/linux/sched.h | 2 +- kernel/sched/core.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
include/linux/sched.h +1 -1
@@ -1877,7 +1877,7 @@ static inline int task_nice(const struct task_struct *p) }extern int can_nice (const struct task_struct *p,const int nice); -extern int task_curr (const struct task_struct *p); +extern bool task_curr (const struct task_struct *p);extern int idle_cpu (int cpu);extern int sched_setscheduler (struct task_struct *,int ,const struct sched_param *);extern int sched_setscheduler_nocheck (struct task_struct *,int ,const struct sched_param *);
kernel/sched/core.c +2 -2
@@ -2163,9 +2163,9 @@ static void block_task(struct rq *rq, struct task_struct *p, int flags)* task_curr - is this task currently executing on a CPU? * @p: the task in question. * -* Return: 1 if the task is currently executing. 0 otherwise. +* Return: true if the task is currently executing, false otherwise. */ -inline int task_curr (const struct task_struct *p) +inline bool task_curr (const struct task_struct *p) {return cpu_curr (task_cpu (p)) == p; }
Signature · 1 line
2.43.0