Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91084
b: refs/heads/master
c: cd8ba7c
h: refs/heads/master
v: v3
  • Loading branch information
Mike Travis authored and Ingo Molnar committed Apr 19, 2008
1 parent 8f96428 commit ead4d17
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e0982e90cd1ecf59818b137386b7f63debded9cc
refs/heads/master: cd8ba7cd9be0192348c2836cb6645d9b2cd2bfd2
15 changes: 11 additions & 4 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,8 @@ struct sched_class {
void (*set_curr_task) (struct rq *rq);
void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
void (*task_new) (struct rq *rq, struct task_struct *p);
void (*set_cpus_allowed)(struct task_struct *p, cpumask_t *newmask);
void (*set_cpus_allowed)(struct task_struct *p,
const cpumask_t *newmask);

void (*join_domain)(struct rq *rq);
void (*leave_domain)(struct rq *rq);
Expand Down Expand Up @@ -1502,15 +1503,21 @@ static inline void put_task_struct(struct task_struct *t)
#define used_math() tsk_used_math(current)

#ifdef CONFIG_SMP
extern int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask);
extern int set_cpus_allowed_ptr(struct task_struct *p,
const cpumask_t *new_mask);
#else
static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
static inline int set_cpus_allowed_ptr(struct task_struct *p,
const cpumask_t *new_mask)
{
if (!cpu_isset(0, new_mask))
if (!cpu_isset(0, *new_mask))
return -EINVAL;
return 0;
}
#endif
static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
{
return set_cpus_allowed_ptr(p, &new_mask);
}

extern unsigned long long sched_clock(void);

Expand Down
16 changes: 8 additions & 8 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -5486,31 +5486,31 @@ static inline void sched_init_granularity(void)
* task must not exit() & deallocate itself prematurely. The
* call is not atomic; no spinlocks may be held.
*/
int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
int set_cpus_allowed_ptr(struct task_struct *p, const cpumask_t *new_mask)
{
struct migration_req req;
unsigned long flags;
struct rq *rq;
int ret = 0;

rq = task_rq_lock(p, &flags);
if (!cpus_intersects(new_mask, cpu_online_map)) {
if (!cpus_intersects(*new_mask, cpu_online_map)) {
ret = -EINVAL;
goto out;
}

if (p->sched_class->set_cpus_allowed)
p->sched_class->set_cpus_allowed(p, &new_mask);
p->sched_class->set_cpus_allowed(p, new_mask);
else {
p->cpus_allowed = new_mask;
p->rt.nr_cpus_allowed = cpus_weight(new_mask);
p->cpus_allowed = *new_mask;
p->rt.nr_cpus_allowed = cpus_weight(*new_mask);
}

/* Can the task run on the task's current CPU? If so, we're done */
if (cpu_isset(task_cpu(p), new_mask))
if (cpu_isset(task_cpu(p), *new_mask))
goto out;

if (migrate_task(p, any_online_cpu(new_mask), &req)) {
if (migrate_task(p, any_online_cpu(*new_mask), &req)) {
/* Need help from migration thread: drop lock and wait. */
task_rq_unlock(rq, &flags);
wake_up_process(rq->migration_thread);
Expand All @@ -5523,7 +5523,7 @@ int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)

return ret;
}
EXPORT_SYMBOL_GPL(set_cpus_allowed);
EXPORT_SYMBOL_GPL(set_cpus_allowed_ptr);

/*
* Move (not current) task off this cpu, onto dest cpu. We're doing
Expand Down
3 changes: 2 additions & 1 deletion trunk/kernel/sched_rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,8 @@ move_one_task_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
return 0;
}

static void set_cpus_allowed_rt(struct task_struct *p, cpumask_t *new_mask)
static void set_cpus_allowed_rt(struct task_struct *p,
const cpumask_t *new_mask)
{
int weight = cpus_weight(*new_mask);

Expand Down

0 comments on commit ead4d17

Please sign in to comment.