Re: [PATCH 1/2] perf session: Add option to copy events when queueing

From: Arnaldo Carvalho de Melo
Date: Mon Sep 29 2014 - 14:34:07 EST


Em Mon, Sep 22, 2014 at 09:04:10AM +0200, Jiri Olsa escreveu:
> On Thu, Sep 18, 2014 at 09:07:38PM +0400, Alexander Yarygin wrote:
> > +++ b/tools/perf/util/session.c
> > @@ -542,7 +542,13 @@ int perf_session_queue_event(struct perf_session *s, union perf_event *event,
> > return -ENOMEM;

> > new->file_offset = file_offset;
> > - new->event = event;

> > + if (s->copy_on_queue) {
> > + new->event = malloc(event->header.size);
> > + memcpy(new->event, event, event->header.size);

> we have memdup, and you need to check for allocation failure

Right.

> hum.. how about allocation limits?

> Now have report.queue-size to keep track and limit the ordered_events
> memory size. I think we should add this allocation size under this
> limit as well.

Yup.

> > + } else
> > + new->event = event;
> > +
>
> also the copy_on_queue flag and the logic above feels more like
> it belongs to 'ordered_events' object to me

Agreed.

- Arnaldo
--
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/