linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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>,
	Peter Zijlstra <peterz@infradead.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	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 decompression of PERF_RECORD_COMPRESSED records
Date: Fri, 15 Nov 2019 20:09:19 +0300	[thread overview]
Message-ID: <2f2b2421-6865-4669-7e30-918d12ae5e01@linux.intel.com> (raw)
In-Reply-To: <20191115151124.GA25246@krava>


On 15.11.2019 18:11, Jiri Olsa wrote:
> On Fri, Nov 15, 2019 at 12:05:14PM +0300, Alexey Budankov wrote:
<SNIP>
>> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
>> index f07b8ecb91bc..3f6f812ec4ed 100644
>> --- a/tools/perf/util/session.c
>> +++ b/tools/perf/util/session.c
>> @@ -1957,9 +1957,31 @@ static int __perf_session__process_pipe_events(struct perf_session *session)
>>  	return err;
>>  }
>>  
>> +static union perf_event *
>> +prefetch_event(char *buf, u64 head, size_t mmap_size,
>> +	       bool needs_swap, union perf_event *ret);
> 
> why not move prefetch_event definition in here?
> I don't see any need for the static declaration..

It is just for the sake of more readable patch formatting 
and, yes, could be avoided and replaced by the definition.

> 
>> +
>>  static union perf_event *
>>  fetch_mmaped_event(struct perf_session *session,
>>  		   u64 head, size_t mmap_size, char *buf)
>> +{
>> +	return prefetch_event(buf, head, mmap_size,
>> +			      session->header.needs_swap,
>> +			      ERR_PTR(-EINVAL));
>> +}
>> +
>> +static union perf_event *
>> +fetch_decomp_event(struct perf_session *session,
>> +		   u64 head, size_t mmap_size, char *buf)
>> +{
> 
> if this is decomp specific, it could take 'struct decomp*' as argument

Well, it makes sense. whole session object is not required here.
Just session->header.needs_swap could be passed as a param.
Shall we make it like this?

static union perf_event * 
fetch_decomp_event(u64 head, size_t mmap_size, char *buf, bool needs_swap)

> 
>> +	return prefetch_event(buf, head, mmap_size,
>> +			      session->header.needs_swap,
>> +			      NULL);
>> +}
>> +
>> +static union perf_event *
>> +prefetch_event(char *buf, u64 head, size_t mmap_size,
>> +	       bool needs_swap, union perf_event *ret)
>>  {
> 
> 'error' might be more suitable then ret in here

Accepted for v2.

~Alexey

> 
> thanks,
> jirka
> 
> 

  reply	other threads:[~2019-11-15 17:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15  9:05 [PATCH v1] perf session: fix decompression of PERF_RECORD_COMPRESSED records Alexey Budankov
2019-11-15 15:11 ` Jiri Olsa
2019-11-15 17:09   ` Alexey Budankov [this message]
2019-11-18 10:46     ` Jiri Olsa

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=2f2b2421-6865-4669-7e30-918d12ae5e01@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;
as well as URLs for NNTP newsgroup(s).