Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182381
b: refs/heads/master
c: d6f962b
h: refs/heads/master
i:
  182379: a3aec35
v: v3
  • Loading branch information
Frederic Weisbecker committed Jan 16, 2010
1 parent d9470ad commit 482afb9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 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: e286417378b4f9ce6e473b556193465ab22e12ab
refs/heads/master: d6f962b57bfaab62891c7abbf1469212a56d6103
5 changes: 5 additions & 0 deletions trunk/include/linux/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,10 @@ typedef void (*perf_overflow_handler_t)(struct perf_event *, int,
struct perf_sample_data *,
struct pt_regs *regs);

enum perf_group_flag {
PERF_GROUP_SOFTWARE = 0x1,
};

/**
* struct perf_event - performance event kernel representation:
*/
Expand All @@ -574,6 +578,7 @@ struct perf_event {
struct list_head event_entry;
struct list_head sibling_list;
int nr_siblings;
int group_flags;
struct perf_event *group_leader;
struct perf_event *output;
const struct pmu *pmu;
Expand Down
30 changes: 11 additions & 19 deletions trunk/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,16 @@ list_add_event(struct perf_event *event, struct perf_event_context *ctx)
if (group_leader == event) {
struct list_head *list;

if (is_software_event(event))
event->group_flags |= PERF_GROUP_SOFTWARE;

list = ctx_group_list(event, ctx);
list_add_tail(&event->group_entry, list);
} else {
if (group_leader->group_flags & PERF_GROUP_SOFTWARE &&
!is_software_event(event))
group_leader->group_flags &= ~PERF_GROUP_SOFTWARE;

list_add_tail(&event->group_entry, &group_leader->sibling_list);
group_leader->nr_siblings++;
}
Expand Down Expand Up @@ -372,6 +379,9 @@ list_del_event(struct perf_event *event, struct perf_event_context *ctx)
list = ctx_group_list(event, ctx);
list_move_tail(&sibling->group_entry, list);
sibling->group_leader = sibling;

/* Inherit group flags from the previous leader */
sibling->group_flags = event->group_flags;
}
}

Expand Down Expand Up @@ -699,24 +709,6 @@ group_sched_in(struct perf_event *group_event,
return -EAGAIN;
}

/*
* Return 1 for a group consisting entirely of software events,
* 0 if the group contains any hardware events.
*/
static int is_software_only_group(struct perf_event *leader)
{
struct perf_event *event;

if (!is_software_event(leader))
return 0;

list_for_each_entry(event, &leader->sibling_list, group_entry)
if (!is_software_event(event))
return 0;

return 1;
}

/*
* Work out whether we can put this event group on the CPU now.
*/
Expand All @@ -727,7 +719,7 @@ static int group_can_go_on(struct perf_event *event,
/*
* Groups consisting entirely of software events can always go on.
*/
if (is_software_only_group(event))
if (event->group_flags & PERF_GROUP_SOFTWARE)
return 1;
/*
* If an exclusive group is already on, no other hardware
Expand Down

0 comments on commit 482afb9

Please sign in to comment.