Commit afbeb90f authored by Keith Owens's avatar Keith Owens Committed by Linus Torvalds

[PATCH] contify some scheduler functions

Several scheduler macros only read from the task struct, mark them const.
It may help the compiler generate better code.
Signed-off-by: default avatarKeith Owens <kaos@ocs.com.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 780fac4d
...@@ -688,9 +688,9 @@ extern void sched_balance_exec(void); ...@@ -688,9 +688,9 @@ extern void sched_balance_exec(void);
extern void sched_idle_next(void); extern void sched_idle_next(void);
extern void set_user_nice(task_t *p, long nice); extern void set_user_nice(task_t *p, long nice);
extern int task_prio(task_t *p); extern int task_prio(const task_t *p);
extern int task_nice(task_t *p); extern int task_nice(const task_t *p);
extern int task_curr(task_t *p); extern int task_curr(const task_t *p);
extern int idle_cpu(int cpu); extern int idle_cpu(int cpu);
void yield(void); void yield(void);
...@@ -917,7 +917,7 @@ extern void wait_task_inactive(task_t * p); ...@@ -917,7 +917,7 @@ extern void wait_task_inactive(task_t * p);
#define while_each_thread(g, t) \ #define while_each_thread(g, t) \
while ((t = next_thread(t)) != g) while ((t = next_thread(t)) != g)
extern task_t * FASTCALL(next_thread(task_t *p)); extern task_t * FASTCALL(next_thread(const task_t *p));
#define thread_group_leader(p) (p->pid == p->tgid) #define thread_group_leader(p) (p->pid == p->tgid)
...@@ -1058,7 +1058,7 @@ extern void signal_wake_up(struct task_struct *t, int resume_stopped); ...@@ -1058,7 +1058,7 @@ extern void signal_wake_up(struct task_struct *t, int resume_stopped);
*/ */
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
static inline unsigned int task_cpu(struct task_struct *p) static inline unsigned int task_cpu(const struct task_struct *p)
{ {
return p->thread_info->cpu; return p->thread_info->cpu;
} }
...@@ -1070,7 +1070,7 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu) ...@@ -1070,7 +1070,7 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
#else #else
static inline unsigned int task_cpu(struct task_struct *p) static inline unsigned int task_cpu(const struct task_struct *p)
{ {
return 0; return 0;
} }
......
...@@ -834,10 +834,10 @@ asmlinkage long sys_exit(int error_code) ...@@ -834,10 +834,10 @@ asmlinkage long sys_exit(int error_code)
do_exit((error_code&0xff)<<8); do_exit((error_code&0xff)<<8);
} }
task_t fastcall *next_thread(task_t *p) task_t fastcall *next_thread(const task_t *p)
{ {
struct pid_link *link = p->pids + PIDTYPE_TGID; const struct pid_link *link = p->pids + PIDTYPE_TGID;
struct list_head *tmp, *head = &link->pidptr->task_list; const struct list_head *tmp, *head = &link->pidptr->task_list;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (!p->sighand) if (!p->sighand)
......
...@@ -546,7 +546,7 @@ static inline void resched_task(task_t *p) ...@@ -546,7 +546,7 @@ static inline void resched_task(task_t *p)
* task_curr - is this task currently executing on a CPU? * task_curr - is this task currently executing on a CPU?
* @p: the task in question. * @p: the task in question.
*/ */
inline int task_curr(task_t *p) inline int task_curr(const task_t *p)
{ {
return cpu_curr(task_cpu(p)) == p; return cpu_curr(task_cpu(p)) == p;
} }
...@@ -2658,7 +2658,7 @@ asmlinkage long sys_nice(int increment) ...@@ -2658,7 +2658,7 @@ asmlinkage long sys_nice(int increment)
* RT tasks are offset by -200. Normal tasks are centered * RT tasks are offset by -200. Normal tasks are centered
* around 0, value goes from -16 to +15. * around 0, value goes from -16 to +15.
*/ */
int task_prio(task_t *p) int task_prio(const task_t *p)
{ {
return p->prio - MAX_RT_PRIO; return p->prio - MAX_RT_PRIO;
} }
...@@ -2667,7 +2667,7 @@ int task_prio(task_t *p) ...@@ -2667,7 +2667,7 @@ int task_prio(task_t *p)
* task_nice - return the nice value of a given task. * task_nice - return the nice value of a given task.
* @p: the task in question. * @p: the task in question.
*/ */
int task_nice(task_t *p) int task_nice(const task_t *p)
{ {
return TASK_NICE(p); return TASK_NICE(p);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment