diff options
author | Mike Travis <travis@sgi.com> | 2008-03-26 17:23:49 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-19 13:44:59 -0400 |
commit | cd8ba7cd9be0192348c2836cb6645d9b2cd2bfd2 (patch) | |
tree | 3b4138c7b683c2168ac13be41aab74b49a6bcf1c /include/linux/sched.h | |
parent | e0982e90cd1ecf59818b137386b7f63debded9cc (diff) |
sched: add new set_cpus_allowed_ptr function
Add a new function that accepts a pointer to the "newly allowed cpus"
cpumask argument.
int set_cpus_allowed_ptr(struct task_struct *p, const cpumask_t *new_mask)
The current set_cpus_allowed() function is modified to use the above
but this does not result in an ABI change. And with some compiler
optimization help, it may not introduce any additional overhead.
Additionally, to enforce the read only nature of the new_mask arg, the
"const" property is migrated to sub-functions called by set_cpus_allowed.
This silences compiler warnings.
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 383502dfda17..79c025c3b627 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -889,7 +889,8 @@ struct sched_class { | |||
889 | void (*set_curr_task) (struct rq *rq); | 889 | void (*set_curr_task) (struct rq *rq); |
890 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); | 890 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); |
891 | void (*task_new) (struct rq *rq, struct task_struct *p); | 891 | void (*task_new) (struct rq *rq, struct task_struct *p); |
892 | void (*set_cpus_allowed)(struct task_struct *p, cpumask_t *newmask); | 892 | void (*set_cpus_allowed)(struct task_struct *p, |
893 | const cpumask_t *newmask); | ||
893 | 894 | ||
894 | void (*join_domain)(struct rq *rq); | 895 | void (*join_domain)(struct rq *rq); |
895 | void (*leave_domain)(struct rq *rq); | 896 | void (*leave_domain)(struct rq *rq); |
@@ -1502,15 +1503,21 @@ static inline void put_task_struct(struct task_struct *t) | |||
1502 | #define used_math() tsk_used_math(current) | 1503 | #define used_math() tsk_used_math(current) |
1503 | 1504 | ||
1504 | #ifdef CONFIG_SMP | 1505 | #ifdef CONFIG_SMP |
1505 | extern int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask); | 1506 | extern int set_cpus_allowed_ptr(struct task_struct *p, |
1507 | const cpumask_t *new_mask); | ||
1506 | #else | 1508 | #else |
1507 | static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) | 1509 | static inline int set_cpus_allowed_ptr(struct task_struct *p, |
1510 | const cpumask_t *new_mask) | ||
1508 | { | 1511 | { |
1509 | if (!cpu_isset(0, new_mask)) | 1512 | if (!cpu_isset(0, *new_mask)) |
1510 | return -EINVAL; | 1513 | return -EINVAL; |
1511 | return 0; | 1514 | return 0; |
1512 | } | 1515 | } |
1513 | #endif | 1516 | #endif |
1517 | static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) | ||
1518 | { | ||
1519 | return set_cpus_allowed_ptr(p, &new_mask); | ||
1520 | } | ||
1514 | 1521 | ||
1515 | extern unsigned long long sched_clock(void); | 1522 | extern unsigned long long sched_clock(void); |
1516 | 1523 | ||