Re: [PATCH] perf_events: fix errors path in perf_output_begin()

From: Stephane Eranian
Date: Mon May 17 2010 - 08:04:53 EST


On Mon, May 17, 2010 at 2:03 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Mon, 2010-05-17 at 13:56 +0200, Stephane Eranian wrote:
>> >> + Â Â if (!data->nr_pages) {
>> >> + Â Â Â Â Â Â atomic_inc(&data->lost);
>> >> + Â Â Â Â Â Â goto out;
>> >> + Â Â }
>
>
>> Well, nr_pages = 0 means all you have is the sampling buffer
>> header page. You cannot save any sample, so you Âactually
>> loose everything. Perf reports a dozen samples but those
>> are synthetic. The kernel cannot reject an mmap() for
>> just one page because of the remapped counters, thus it
>> has to handle this gracefully and at least report the lost
>> samples.
>
> So you want to preserve this state for when you munmap() and mmap()
> again? The only user of data->lost is writing the PERF_RECORD_LOST
> event, which only ever happens when you have pages, so counting it when
> there's no pages seems futile.

You're right. But couldn't you report lost samples in the buffer header as well?
--
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/