public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>,
	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: Tue, 16 Jul 2019 22:59:30 +0200	[thread overview]
Message-ID: <20190716205930.GF28722@krava> (raw)
In-Reply-To: <20190716184959.GG3624@kernel.org>

On Tue, Jul 16, 2019 at 03:49:59PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jul 15, 2019 at 03:30:24PM +0300, Alexey Budankov escreveu:
> > 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 - :)

well it's passed as value, so should be ok,
anyway I was just curious, if I'm not missing
something else.. it's ok ;-)

> 
> So, Jiri, Acked-by?

yep ;-)

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> 
> - Arnaldo

  reply	other threads:[~2019-07-16 20:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09 14:48 [PATCH v1] perf session: fix loading of compressed data split across adjacent records Alexey Budankov
2019-07-14 15:49 ` Jiri Olsa
2019-07-15 12:30   ` Alexey Budankov
2019-07-16 18:49     ` Arnaldo Carvalho de Melo
2019-07-16 20:59       ` Jiri Olsa [this message]
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=20190716205930.GF28722@krava \
    --to=jolsa@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=arnaldo.melo@gmail.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