Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8347
b: refs/heads/master
c: da5a552
h: refs/heads/master
i:
  8345: 05e8fcb
  8343: b0d61e6
v: v3
  • Loading branch information
M.Baris Demiray authored and Linus Torvalds committed Sep 10, 2005
1 parent 11d2175 commit 537a584
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 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: fc38ed7531eefa332c8c69ee288487860cd6b426
refs/heads/master: da5a5522709a030da91932d4d4c2b179a481a8c0
17 changes: 13 additions & 4 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,8 +966,11 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, int this_cpu)
int local_group;
int i;

/* Skip over this group if it has no CPUs allowed */
if (!cpus_intersects(group->cpumask, p->cpus_allowed))
goto nextgroup;

local_group = cpu_isset(this_cpu, group->cpumask);
/* XXX: put a cpus allowed check */

/* Tally up the load of all CPUs in the group */
avg_load = 0;
Expand All @@ -992,6 +995,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, int this_cpu)
min_load = avg_load;
idlest = group;
}
nextgroup:
group = group->next;
} while (group != sd->groups);

Expand All @@ -1003,13 +1007,18 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, int this_cpu)
/*
* find_idlest_queue - find the idlest runqueue among the cpus in group.
*/
static int find_idlest_cpu(struct sched_group *group, int this_cpu)
static int find_idlest_cpu(struct sched_group *group,
struct task_struct *p, int this_cpu)
{
cpumask_t tmp;
unsigned long load, min_load = ULONG_MAX;
int idlest = -1;
int i;

for_each_cpu_mask(i, group->cpumask) {
/* Traverse only the allowed CPUs */
cpus_and(tmp, group->cpumask, p->cpus_allowed);

for_each_cpu_mask(i, tmp) {
load = source_load(i, 0);

if (load < min_load || (load == min_load && i == this_cpu)) {
Expand Down Expand Up @@ -1052,7 +1061,7 @@ static int sched_balance_self(int cpu, int flag)
if (!group)
goto nextlevel;

new_cpu = find_idlest_cpu(group, cpu);
new_cpu = find_idlest_cpu(group, t, cpu);
if (new_cpu == -1 || new_cpu == cpu)
goto nextlevel;

Expand Down

0 comments on commit 537a584

Please sign in to comment.