lkml.org 
[lkml]   [2010]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/6] perf: Round robin groups of events using list_rotate_left()
Date
This is more proper that doing it through a list_for_each_entry()
that breaks after the first entry.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
---
kernel/perf_event.c | 13 +++----------
1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index c9f8a75..d7254f5 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1454,8 +1454,6 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
*/
static void rotate_ctx(struct perf_event_context *ctx)
{
- struct perf_event *event;
-
if (!ctx->nr_events)
return;

@@ -1464,15 +1462,10 @@ static void rotate_ctx(struct perf_event_context *ctx)
* Rotate the first entry last (works just fine for group events too):
*/
perf_disable();
- list_for_each_entry(event, &ctx->pinned_groups, group_entry) {
- list_move_tail(&event->group_entry, &ctx->pinned_groups);
- break;
- }

- list_for_each_entry(event, &ctx->flexible_groups, group_entry) {
- list_move_tail(&event->group_entry, &ctx->flexible_groups);
- break;
- }
+ list_rotate_left(&ctx->pinned_groups);
+ list_rotate_left(&ctx->flexible_groups);
+
perf_enable();

raw_spin_unlock(&ctx->lock);
--
1.6.2.3


\
 
 \ /
  Last update: 2010-01-10 02:41    [W:0.102 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site