Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147166
b: refs/heads/master
c: 7995888
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Dec 23, 2008
1 parent 1f06e1c commit e5f9ad1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 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: 8fb9331391af95ca1f4e5c0a0da8120b13cbae01
refs/heads/master: 7995888fcb0246543ee8027bf2835a250ba8c925
16 changes: 13 additions & 3 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,21 +367,26 @@ counter_sched_in(struct perf_counter *counter,
ctx->nr_active++;
}

static void
static int
group_sched_in(struct perf_counter *group_counter,
struct perf_cpu_context *cpuctx,
struct perf_counter_context *ctx,
int cpu)
{
struct perf_counter *counter;
int was_group = 0;

counter_sched_in(group_counter, cpuctx, ctx, cpu);

/*
* Schedule in siblings as one group (if any):
*/
list_for_each_entry(counter, &group_counter->sibling_list, list_entry)
list_for_each_entry(counter, &group_counter->sibling_list, list_entry) {
counter_sched_in(counter, cpuctx, ctx, cpu);
was_group = 1;
}

return was_group;
}

/*
Expand Down Expand Up @@ -416,7 +421,12 @@ void perf_counter_task_sched_in(struct task_struct *task, int cpu)
if (counter->cpu != -1 && counter->cpu != cpu)
continue;

group_sched_in(counter, cpuctx, ctx, cpu);
/*
* If we scheduled in a group atomically and
* exclusively, break out:
*/
if (group_sched_in(counter, cpuctx, ctx, cpu))
break;
}
spin_unlock(&ctx->lock);

Expand Down

0 comments on commit e5f9ad1

Please sign in to comment.