[PATCH 6/6] perf: Increase round-robin fairness of flexible events

From: Frederic Weisbecker
Date: Sat Jan 09 2010 - 20:39:01 EST


Group of flexible events are round-robined in each tick so that
each group has its chance to be scheduled. But the fairness
per group granularity doesn't propagate inside the groups
themselves.

If only the first events of each groups have a chance to make
their way, the remaining ones will never be scheduled.

Hence this patch propagates the round-robin to the events
inside the groups.

Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
---
kernel/perf_event.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 584e854..407137a 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1446,16 +1446,21 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
*/
static void rotate_ctx(struct perf_event_context *ctx)
{
+ struct perf_event *leader;
+
if (!ctx->nr_events)
return;

raw_spin_lock(&ctx->lock);
/*
* Rotate the first entry last of non-pinned groups
+ * and events inside these groups
*/
perf_disable();

list_rotate_left(&ctx->flexible_groups);
+ list_for_each_entry(leader, &ctx->flexible_groups, group_entry)
+ list_rotate_left(&leader->sibling_list);

perf_enable();

--
1.6.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/