diff options
| author | Ingo Molnar <mingo@elte.hu> | 2009-09-21 04:18:27 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-09-21 06:54:51 -0400 |
| commit | 65abc8653c282ded3dbdb9ec1227784140ba28cd (patch) | |
| tree | 299d9dc0e3548016cc01eb2b13db6ea51d519ebb | |
| parent | ae82bfd61ca7e57cc2d914add9ab0873e260f2f5 (diff) | |
perf_counter: Rename list_entry -> group_entry, counter_list -> group_list
This is in preparation of the big rename, but also makes sense
in a standalone way: 'list_entry' is a bad name as we already
have a list_entry() in list.h.
Also, the 'counter list' is too vague, it doesnt tell us the
purpose of that list.
Clarify these names to show that it's all about the group
hiearchy.
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
| -rw-r--r-- | include/linux/perf_counter.h | 4 | ||||
| -rw-r--r-- | kernel/perf_counter.c | 71 |
2 files changed, 37 insertions, 38 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index 740caad09a44..f64862732673 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
| @@ -543,7 +543,7 @@ struct perf_pending_entry { | |||
| 543 | */ | 543 | */ |
| 544 | struct perf_counter { | 544 | struct perf_counter { |
| 545 | #ifdef CONFIG_PERF_COUNTERS | 545 | #ifdef CONFIG_PERF_COUNTERS |
| 546 | struct list_head list_entry; | 546 | struct list_head group_entry; |
| 547 | struct list_head event_entry; | 547 | struct list_head event_entry; |
| 548 | struct list_head sibling_list; | 548 | struct list_head sibling_list; |
| 549 | int nr_siblings; | 549 | int nr_siblings; |
| @@ -649,7 +649,7 @@ struct perf_counter_context { | |||
| 649 | */ | 649 | */ |
| 650 | struct mutex mutex; | 650 | struct mutex mutex; |
| 651 | 651 | ||
| 652 | struct list_head counter_list; | 652 | struct list_head group_list; |
| 653 | struct list_head event_list; | 653 | struct list_head event_list; |
| 654 | int nr_counters; | 654 | int nr_counters; |
| 655 | int nr_active; | 655 | int nr_active; |
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index cc768ab81ac8..13ad73aed4ca 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
| @@ -258,9 +258,9 @@ list_add_counter(struct perf_counter *counter, struct perf_counter_context *ctx) | |||
| 258 | * leader's sibling list: | 258 | * leader's sibling list: |
| 259 | */ | 259 | */ |
| 260 | if (group_leader == counter) | 260 | if (group_leader == counter) |
| 261 | list_add_tail(&counter->list_entry, &ctx->counter_list); | 261 | list_add_tail(&counter->group_entry, &ctx->group_list); |
| 262 | else { | 262 | else { |
| 263 | list_add_tail(&counter->list_entry, &group_leader->sibling_list); | 263 | list_add_tail(&counter->group_entry, &group_leader->sibling_list); |
| 264 | group_leader->nr_siblings++; | 264 | group_leader->nr_siblings++; |
| 265 | } | 265 | } |
| 266 | 266 | ||
| @@ -279,13 +279,13 @@ list_del_counter(struct perf_counter *counter, struct perf_counter_context *ctx) | |||
| 279 | { | 279 | { |
| 280 | struct perf_counter *sibling, *tmp; | 280 | struct perf_counter *sibling, *tmp; |
| 281 | 281 | ||
| 282 | if (list_empty(&counter->list_entry)) | 282 | if (list_empty(&counter->group_entry)) |
| 283 | return; | 283 | return; |
| 284 | ctx->nr_counters--; | 284 | ctx->nr_counters--; |
| 285 | if (counter->attr.inherit_stat) | 285 | if (counter->attr.inherit_stat) |
| 286 | ctx->nr_stat--; | 286 | ctx->nr_stat--; |
| 287 | 287 | ||
| 288 | list_del_init(&counter->list_entry); | 288 | list_del_init(&counter->group_entry); |
| 289 | list_del_rcu(&counter->event_entry); | 289 | list_del_rcu(&counter->event_entry); |
| 290 | 290 | ||
| 291 | if (counter->group_leader != counter) | 291 | if (counter->group_leader != counter) |
| @@ -296,10 +296,9 @@ list_del_counter(struct perf_counter *counter, struct perf_counter_context *ctx) | |||
| 296 | * upgrade the siblings to singleton counters by adding them | 296 | * upgrade the siblings to singleton counters by adding them |
| 297 | * to the context list directly: | 297 | * to the context list directly: |
| 298 | */ | 298 | */ |
| 299 | list_for_each_entry_safe(sibling, tmp, | 299 | list_for_each_entry_safe(sibling, tmp, &counter->sibling_list, group_entry) { |
| 300 | &counter->sibling_list, list_entry) { | ||
| 301 | 300 | ||
| 302 | list_move_tail(&sibling->list_entry, &ctx->counter_list); | 301 | list_move_tail(&sibling->group_entry, &ctx->group_list); |
| 303 | sibling->group_leader = sibling; | 302 | sibling->group_leader = sibling; |
| 304 | } | 303 | } |
| 305 | } | 304 | } |
| @@ -343,7 +342,7 @@ group_sched_out(struct perf_counter *group_counter, | |||
| 343 | /* | 342 | /* |
| 344 | * Schedule out siblings (if any): | 343 | * Schedule out siblings (if any): |
| 345 | */ | 344 | */ |
| 346 | list_for_each_entry(counter, &group_counter->sibling_list, list_entry) | 345 | list_for_each_entry(counter, &group_counter->sibling_list, group_entry) |
| 347 | counter_sched_out(counter, cpuctx, ctx); | 346 | counter_sched_out(counter, cpuctx, ctx); |
| 348 | 347 | ||
| 349 | if (group_counter->attr.exclusive) | 348 | if (group_counter->attr.exclusive) |
| @@ -435,7 +434,7 @@ retry: | |||
| 435 | /* | 434 | /* |
| 436 | * If the context is active we need to retry the smp call. | 435 | * If the context is active we need to retry the smp call. |
| 437 | */ | 436 | */ |
| 438 | if (ctx->nr_active && !list_empty(&counter->list_entry)) { | 437 | if (ctx->nr_active && !list_empty(&counter->group_entry)) { |
| 439 | spin_unlock_irq(&ctx->lock); | 438 | spin_unlock_irq(&ctx->lock); |
| 440 | goto retry; | 439 | goto retry; |
| 441 | } | 440 | } |
| @@ -445,7 +444,7 @@ retry: | |||
| 445 | * can remove the counter safely, if the call above did not | 444 | * can remove the counter safely, if the call above did not |
| 446 | * succeed. | 445 | * succeed. |
| 447 | */ | 446 | */ |
| 448 | if (!list_empty(&counter->list_entry)) { | 447 | if (!list_empty(&counter->group_entry)) { |
| 449 | list_del_counter(counter, ctx); | 448 | list_del_counter(counter, ctx); |
| 450 | } | 449 | } |
| 451 | spin_unlock_irq(&ctx->lock); | 450 | spin_unlock_irq(&ctx->lock); |
| @@ -497,7 +496,7 @@ static void update_group_times(struct perf_counter *leader) | |||
| 497 | struct perf_counter *counter; | 496 | struct perf_counter *counter; |
| 498 | 497 | ||
| 499 | update_counter_times(leader); | 498 | update_counter_times(leader); |
| 500 | list_for_each_entry(counter, &leader->sibling_list, list_entry) | 499 | list_for_each_entry(counter, &leader->sibling_list, group_entry) |
| 501 | update_counter_times(counter); | 500 | update_counter_times(counter); |
| 502 | } | 501 | } |
| 503 | 502 | ||
| @@ -643,7 +642,7 @@ group_sched_in(struct perf_counter *group_counter, | |||
| 643 | /* | 642 | /* |
| 644 | * Schedule in siblings as one group (if any): | 643 | * Schedule in siblings as one group (if any): |
| 645 | */ | 644 | */ |
| 646 | list_for_each_entry(counter, &group_counter->sibling_list, list_entry) { | 645 | list_for_each_entry(counter, &group_counter->sibling_list, group_entry) { |
| 647 | if (counter_sched_in(counter, cpuctx, ctx, cpu)) { | 646 | if (counter_sched_in(counter, cpuctx, ctx, cpu)) { |
| 648 | partial_group = counter; | 647 | partial_group = counter; |
| 649 | goto group_error; | 648 | goto group_error; |
| @@ -657,7 +656,7 @@ group_error: | |||
| 657 | * Groups can be scheduled in as one unit only, so undo any | 656 | * Groups can be scheduled in as one unit only, so undo any |
| 658 | * partial group before returning: | 657 | * partial group before returning: |
| 659 | */ | 658 | */ |
| 660 | list_for_each_entry(counter, &group_counter->sibling_list, list_entry) { | 659 | list_for_each_entry(counter, &group_counter->sibling_list, group_entry) { |
| 661 | if (counter == partial_group) | 660 | if (counter == partial_group) |
| 662 | break; | 661 | break; |
| 663 | counter_sched_out(counter, cpuctx, ctx); | 662 | counter_sched_out(counter, cpuctx, ctx); |
| @@ -678,7 +677,7 @@ static int is_software_only_group(struct perf_counter *leader) | |||
| 678 | if (!is_software_counter(leader)) | 677 | if (!is_software_counter(leader)) |
| 679 | return 0; | 678 | return 0; |
| 680 | 679 | ||
| 681 | list_for_each_entry(counter, &leader->sibling_list, list_entry) | 680 | list_for_each_entry(counter, &leader->sibling_list, group_entry) |
| 682 | if (!is_software_counter(counter)) | 681 | if (!is_software_counter(counter)) |
| 683 | return 0; | 682 | return 0; |
| 684 | 683 | ||
| @@ -842,7 +841,7 @@ retry: | |||
| 842 | /* | 841 | /* |
| 843 | * we need to retry the smp call. | 842 | * we need to retry the smp call. |
| 844 | */ | 843 | */ |
| 845 | if (ctx->is_active && list_empty(&counter->list_entry)) { | 844 | if (ctx->is_active && list_empty(&counter->group_entry)) { |
| 846 | spin_unlock_irq(&ctx->lock); | 845 | spin_unlock_irq(&ctx->lock); |
| 847 | goto retry; | 846 | goto retry; |
| 848 | } | 847 | } |
| @@ -852,7 +851,7 @@ retry: | |||
| 852 | * can add the counter safely, if it the call above did not | 851 | * can add the counter safely, if it the call above did not |
| 853 | * succeed. | 852 | * succeed. |
| 854 | */ | 853 | */ |
| 855 | if (list_empty(&counter->list_entry)) | 854 | if (list_empty(&counter->group_entry)) |
| 856 | add_counter_to_ctx(counter, ctx); | 855 | add_counter_to_ctx(counter, ctx); |
| 857 | spin_unlock_irq(&ctx->lock); | 856 | spin_unlock_irq(&ctx->lock); |
| 858 | } | 857 | } |
| @@ -872,7 +871,7 @@ static void __perf_counter_mark_enabled(struct perf_counter *counter, | |||
| 872 | 871 | ||
| 873 | counter->state = PERF_COUNTER_STATE_INACTIVE; | 872 | counter->state = PERF_COUNTER_STATE_INACTIVE; |
| 874 | counter->tstamp_enabled = ctx->time - counter->total_time_enabled; | 873 | counter->tstamp_enabled = ctx->time - counter->total_time_enabled; |
| 875 | list_for_each_entry(sub, &counter->sibling_list, list_entry) | 874 | list_for_each_entry(sub, &counter->sibling_list, group_entry) |
| 876 | if (sub->state >= PERF_COUNTER_STATE_INACTIVE) | 875 | if (sub->state >= PERF_COUNTER_STATE_INACTIVE) |
| 877 | sub->tstamp_enabled = | 876 | sub->tstamp_enabled = |
| 878 | |||
