sched: Fix a typo in scheduler
PATCH 1/1 sched: Fix a typo in scheduler
Nice value is MIN_NICE(-20) to MAX_NICE(19), it better uses int instead of long.
--- include/linux/sched.h | 2 +- kernel/sched/core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/sched.h +1 -1
@@ -1830,7 +1830,7 @@ static inline int dl_task_check_affinity(struct task_struct *p, const struct cpu#endif extern int yield_to (struct task_struct *p,bool preempt); -extern void set_user_nice (struct task_struct *p,long nice); +extern void set_user_nice (struct task_struct *p,int nice);extern int task_prio (const struct task_struct *p);/**
kernel/sched/core.c +1 -1
@@ -6888,7 +6888,7 @@ static inline int rt_effective_prio(struct task_struct *p, int prio) }#endif -void set_user_nice (struct task_struct *p,long nice) +void set_user_nice (struct task_struct *p,int nice) {bool queued, running;int old_prio;
Signature · 1 line
2.25.1
Steven Rostedt
reviewerQuoted 2 lines · On Sat, 21 May 2022 12:54:20 +0000 Junwen Wu <[email protected]> wrote:
Nice value is
MIN_NICE(-20)toMAX_NICE(19), it better uses int instead of long.
First of all, the subject is completely incorrect. There's no typo to be fixed. Second, why do you think it's better to use an int instead of long? Long is the natural word size of an architecture.
Now perhaps for consistency, we could fix all the locations that switch between long and int. For example, the sys_nice() definition has nice and retval as long and are set by functions that return int. But then again, sys_nice() returns long (and that cannot be changed).
Unless there's a real issue to be fixed (which I do not see one), I'd say leave it as is, because this change is doing nothing but adding unnecessary churn to the git repo.
Hence, NAK.
-- Steve
Quoted 33 lines
Signed-off-by Junwen Wu <[email protected]>--- include/linux/sched.h | 2 +- kernel/sched/core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)include/linux/sched.h +1
-1@@ -1830,7 +1830,7 @@ static inline int dl_task_check_affinity(struct task_struct *p, const struct cpu#endif extern int yield_to (struct task_struct *p,bool preempt); -extern void set_user_nice (struct task_struct *p,long nice); +extern void set_user_nice (struct task_struct *p,int nice);extern int task_prio (const struct task_struct *p);/** kernel/sched/core.c +1
-1@@ -6888,7 +6888,7 @@ static inline int rt_effective_prio(struct task_struct *p, int prio) }#endif -void set_user_nice (struct task_struct *p,long nice) +void set_user_nice (struct task_struct *p,int nice) {bool queued, running;int old_prio;