Skip to contentSkip to conversation

sched: Change task_curr return type to bool

PATCH New Zhan Xusheng 1 participant 1 message Feb 5 Scheduler

lore
Share & tools
lore
#0 lore raw

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.

---
 include/linux/sched.h | 2 +-
 kernel/sched/core.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
include/linux/sched.h +1 -1
index 5f00b5ed0f3b..89321ce60875 100644
@@ -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
index 045f83ad261e..34598f704c53 100644
@@ -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