From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>,
a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org
Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org
Subject: Re: [PATCH] perf: fixing variable initialisation
Date: Tue, 28 Jul 2015 08:48:25 +0300 [thread overview]
Message-ID: <87k2tkbzo6.fsf@ashishki-desk.ger.corp.intel.com> (raw)
In-Reply-To: <1438036879-16340-1-git-send-email-mathieu.poirier@linaro.org>
Mathieu Poirier <mathieu.poirier@linaro.org> writes:
> Variable 'max_order' needs to be initialised to log2 of the
> number of pages invariant of the no scather-gather PMU option.
> Otherwise 'rb_alloc_aux_page' gets an order that is equal to
> '0', which prevents the private page information to be set
> properly.
But that wouldn't make sense: we're only using the private field in
pages at the bottom of high-order allocations, which only ever happen
for NO_SG devices. Otherwise, every page is the buffer is just an
individual page and doesn't need anything in the private field.
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
> kernel/events/ring_buffer.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
> index 96472824a752..bd3da7bebe9e 100644
> --- a/kernel/events/ring_buffer.c
> +++ b/kernel/events/ring_buffer.c
> @@ -449,18 +449,18 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event,
> {
> bool overwrite = !(flags & RING_BUFFER_WRITABLE);
> int node = (event->cpu == -1) ? -1 : cpu_to_node(event->cpu);
> - int ret = -ENOMEM, max_order = 0;
> + int ret = -ENOMEM, max_order;
>
> if (!has_aux(event))
> return -ENOTSUPP;
>
> - if (event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) {
> - /*
> - * We need to start with the max_order that fits in nr_pages,
> - * not the other way around, hence ilog2() and not get_order.
> - */
> - max_order = ilog2(nr_pages);
> + /*
> + * We need to start with the max_order that fits in nr_pages,
> + * not the other way around, hence ilog2() and not get_order.
> + */
> + max_order = ilog2(nr_pages);
Also, nr_pages here is the whole buffer, but when we do use
page::private, we put an each individual high-order allocation's order
there, not the whole buffer's, which makes sense because you'd need to
know the former to program the HW properly, whereas the latter you'd get
as a parameter to pmu::setup_aux() callback anyway.
Regards,
--
Alex
prev parent reply other threads:[~2015-07-28 5:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-27 22:41 Mathieu Poirier
2015-07-28 5:48 ` Alexander Shishkin [this message]
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=87k2tkbzo6.fsf@ashishki-desk.ger.corp.intel.com \
--to=alexander.shishkin@linux.intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mingo@redhat.com \
/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
all inboxes | Powered by JetHome®