From: Alexey Budankov <alexey.budankov@linux.intel.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Andi Kleen <ak@linux.intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] perf session: fix loading of compressed data split across adjacent records
Date: Mon, 15 Jul 2019 15:30:24 +0300 [thread overview]
Message-ID: <389a8b98-1d53-6fe3-ff56-0789c0841292@linux.intel.com> (raw)
In-Reply-To: <20190714154932.GC16802@krava>
On 14.07.2019 18:49, Jiri Olsa wrote:
> On Tue, Jul 09, 2019 at 05:48:14PM +0300, Alexey Budankov wrote:
>
> SNIP
>
>> decomp->file_pos = file_offset;
>> + decomp->mmap_len = mmap_len;
>> decomp->head = 0;
>>
>> - if (decomp_last) {
>> - decomp_last_rem = decomp_last->size - decomp_last->head;
>> + if (decomp_last_rem) {
>> memcpy(decomp->data, &(decomp_last->data[decomp_last->head]), decomp_last_rem);
>> decomp->size = decomp_last_rem;
>> }
>> @@ -61,7 +67,7 @@ static int perf_session__process_compressed_event(struct perf_session *session,
>> decomp_size = zstd_decompress_stream(&(session->zstd_data), src, src_size,
>> &(decomp->data[decomp_last_rem]), decomp_len - decomp_last_rem);
>> if (!decomp_size) {
>> - munmap(decomp, sizeof(struct decomp) + decomp_len);
>> + munmap(decomp, mmap_len);
>> pr_err("Couldn't decompress data\n");
>> return -1;
>> }
>> @@ -255,15 +261,15 @@ static void perf_session__delete_threads(struct perf_session *session)
>> static void perf_session__release_decomp_events(struct perf_session *session)
>> {
>> struct decomp *next, *decomp;
>> - size_t decomp_len;
>> + size_t mmap_len;
>> next = session->decomp;
>> - decomp_len = session->header.env.comp_mmap_len;
>> do {
>> decomp = next;
>> if (decomp == NULL)
>> break;
>> next = decomp->next;
>> - munmap(decomp, decomp_len + sizeof(struct decomp));
>> + mmap_len = decomp->mmap_len;
>> + munmap(decomp, mmap_len);
>
> what's the need for extra mmap_len variable in here?
> could you just use decomp->mmap_len directly?
To avoid reference to the object being deallocated.
Plain munmap(), yes - :)
~Alexey
>
> otherwise it lookgs good to me
>
> thanks,
> jirka
>
next prev parent reply other threads:[~2019-07-15 12:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-09 14:48 Alexey Budankov
2019-07-14 15:49 ` Jiri Olsa
2019-07-15 12:30 ` Alexey Budankov [this message]
2019-07-16 18:49 ` Arnaldo Carvalho de Melo
2019-07-16 20:59 ` Jiri Olsa
2019-07-17 12:34 ` Arnaldo Carvalho de Melo
2019-07-23 21:50 ` [tip:perf/urgent] perf session: Fix " tip-bot for Alexey Budankov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=389a8b98-1d53-6fe3-ff56-0789c0841292@linux.intel.com \
--to=alexey.budankov@linux.intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome