lkml.org 
[lkml]   [2011]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] perf: Allow set output buffer for tasks in the same thread group
FromLin Ming <>
DateSun, 24 Apr 2011 22:57:44 +0800
Currently, kernel only allows an event to redirect its output to other
events of the same task.

This causes PERF_EVENT_IOC_SET_OUTPUT ioctl fails when an event is
trying to redirect its output to other events in the same thread group.

This patch fixes the bug reported at,
https://lkml.org/lkml/2011/4/6/499

Tested-by: Tim Blechmann <tim@klingt.org>
Tested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
---
kernel/perf_event.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 8e81a98..216a617 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -6379,9 +6379,12 @@ perf_event_set_output(struct perf_event *event, struct perf_event *output_event)
goto out;

/*
- * If its not a per-cpu buffer, it must be the same task.
+ * If its not a per-cpu buffer,
+ * it must be the same task or in the same thread group.
*/
- if (output_event->cpu == -1 && output_event->ctx != event->ctx)
+ if (output_event->cpu == -1 &&
+ !same_thread_group(output_event->ctx->task,
+ event->ctx->task))
goto out;

set:




\
 
 \ /
  Last update: 2011-04-24 17:01    [from the cache]
©2003-2010