Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73839
b: refs/heads/master
c: ce96b5a
h: refs/heads/master
i:
  73837: e45fbb6
  73835: 704330b
  73831: 0edfe76
  73823: b82b04c
v: v3
  • Loading branch information
Dmitry Adamushko authored and Ingo Molnar committed Nov 15, 2007
1 parent 3511b66 commit 40540d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 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: dae51f56204d33444f61d9e7af3ee70aef55daa4
refs/heads/master: ce96b5ac742801718ae86d2adf0500c5abef3782
20 changes: 13 additions & 7 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ static inline struct task_group *task_group(struct task_struct *p)
}

/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
static inline void set_task_cfs_rq(struct task_struct *p)
static inline void set_task_cfs_rq(struct task_struct *p, unsigned int cpu)
{
p->se.cfs_rq = task_group(p)->cfs_rq[task_cpu(p)];
p->se.parent = task_group(p)->se[task_cpu(p)];
p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
p->se.parent = task_group(p)->se[cpu];
}

#else

static inline void set_task_cfs_rq(struct task_struct *p) { }
static inline void set_task_cfs_rq(struct task_struct *p, unsigned int cpu) { }

#endif /* CONFIG_FAIR_GROUP_SCHED */

Expand Down Expand Up @@ -1022,10 +1022,16 @@ unsigned long weighted_cpuload(const int cpu)

static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
{
set_task_cfs_rq(p, cpu);
#ifdef CONFIG_SMP
/*
* After ->cpu is set up to a new value, task_rq_lock(p, ...) can be
* successfuly executed on another CPU. We must ensure that updates of
* per-task data have been completed by this moment.
*/
smp_wmb();
task_thread_info(p)->cpu = cpu;
#endif
set_task_cfs_rq(p);
}

#ifdef CONFIG_SMP
Expand Down Expand Up @@ -7088,7 +7094,7 @@ void sched_move_task(struct task_struct *tsk)
rq = task_rq_lock(tsk, &flags);

if (tsk->sched_class != &fair_sched_class) {
set_task_cfs_rq(tsk);
set_task_cfs_rq(tsk, task_cpu(tsk));
goto done;
}

Expand All @@ -7103,7 +7109,7 @@ void sched_move_task(struct task_struct *tsk)
tsk->sched_class->put_prev_task(rq, tsk);
}

set_task_cfs_rq(tsk);
set_task_cfs_rq(tsk, task_cpu(tsk));

if (on_rq) {
if (unlikely(running))
Expand Down

0 comments on commit 40540d5

Please sign in to comment.