Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3289
b: refs/heads/master
c: a3f21bc
h: refs/heads/master
i:
  3287: 1ebf7e0
v: v3
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Jun 25, 2005
1 parent 34613f6 commit 5581b08
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 26 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: 7897986bad8f6cd50d6149345aca7f6480f49464
refs/heads/master: a3f21bce1fefdf92a4d1705e888d390b10f3ac6f
57 changes: 32 additions & 25 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,38 +1016,45 @@ static int try_to_wake_up(task_t * p, unsigned int state, int sync)
int idx = this_sd->wake_idx;
unsigned int imbalance;

imbalance = 100 + (this_sd->imbalance_pct - 100) / 2;

load = source_load(cpu, idx);
this_load = target_load(this_cpu, idx);

/*
* If sync wakeup then subtract the (maximum possible) effect of
* the currently running task from the load of the current CPU:
*/
if (sync)
this_load -= SCHED_LOAD_SCALE;

/* Don't pull the task off an idle CPU to a busy one */
if (load < SCHED_LOAD_SCALE/2 && this_load > SCHED_LOAD_SCALE/2)
goto out_set_cpu;

new_cpu = this_cpu; /* Wake to this CPU if we can */

if ((this_sd->flags & SD_WAKE_AFFINE) &&
!task_hot(p, rq->timestamp_last_tick, this_sd)) {
/*
* This domain has SD_WAKE_AFFINE and p is cache cold
* in this domain.
*/
schedstat_inc(this_sd, ttwu_move_affine);
goto out_set_cpu;
} else if ((this_sd->flags & SD_WAKE_BALANCE) &&
imbalance*this_load <= 100*load) {
if (this_sd->flags & SD_WAKE_AFFINE) {
unsigned long tl = this_load;
/*
* This domain has SD_WAKE_BALANCE and there is
* an imbalance.
* If sync wakeup then subtract the (maximum possible)
* effect of the currently running task from the load
* of the current CPU:
*/
schedstat_inc(this_sd, ttwu_move_balance);
goto out_set_cpu;
if (sync)
tl -= SCHED_LOAD_SCALE;

if ((tl <= load &&
tl + target_load(cpu, idx) <= SCHED_LOAD_SCALE) ||
100*(tl + SCHED_LOAD_SCALE) <= imbalance*load) {
/*
* This domain has SD_WAKE_AFFINE and
* p is cache cold in this domain, and
* there is no bad imbalance.
*/
schedstat_inc(this_sd, ttwu_move_affine);
goto out_set_cpu;
}
}

/*
* Start passive balancing when half the imbalance_pct
* limit is reached.
*/
if (this_sd->flags & SD_WAKE_BALANCE) {
if (imbalance*this_load <= 100*load) {
schedstat_inc(this_sd, ttwu_move_balance);
goto out_set_cpu;
}
}
}

Expand Down

0 comments on commit 5581b08

Please sign in to comment.