Re: ye olde task_ctx_sched_out trace.

From: Peter Zijlstra
Date: Thu May 22 2014 - 03:22:32 EST


On Thu, May 22, 2014 at 09:52:46AM +0300, Adrian Hunter wrote:
> +/*
> + * PERF_RECORD_MISC_MMAP_DATA and PERF_RECORD_MISC_COMM_EXEC are used on
> + * different events so can reuse the same bit position.
> + */
> #define PERF_RECORD_MISC_MMAP_DATA (1 << 13)
> +#define PERF_RECORD_MISC_COMM_EXEC (1 << 13)
> /*
> * Indicates that the content of PERF_SAMPLE_IP points to
> * the actual instruction that triggered the event. See also
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index ed50b09..760abd0 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -5067,7 +5067,7 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
> NULL);
> }
>
> -void perf_event_comm(struct task_struct *task)
> +void perf_event_comm(struct task_struct *task, bool exec)
> {
> struct perf_comm_event comm_event;
> struct perf_event_context *ctx;
> @@ -5093,7 +5093,7 @@ void perf_event_comm(struct task_struct *task)
> .event_id = {
> .header = {
> .type = PERF_RECORD_COMM,
> - .misc = 0,
> + .misc = exec ? PERF_RECORD_MISC_COMM_EXEC : 0,
> /* .size */
> },
> /* .pid */

OK, now that you pointed out the obvious, yeah, I suppose we can do that :-)

Attachment: pgpqkU8UNmq7Q.pgp
Description: PGP signature