From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Will Deacon <will.deacon@arm.com>, linux-kernel@vger.kernel.org
Cc: mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org,
Will Deacon <will.deacon@arm.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 1/2] perf/aux: Make aux_{head,wakeup} ring_buffer members long
Date: Mon, 31 Jul 2017 13:28:01 +0300 [thread overview]
Message-ID: <87ini8uci6.fsf@ashishki-desk.ger.corp.intel.com> (raw)
In-Reply-To: <1501260863-14687-1-git-send-email-will.deacon@arm.com>
Will Deacon <will.deacon@arm.com> writes:
> The aux_head and aux_wakeup members of struct ring_buffer are defined
> using the local_t type, despite the fact that they are only accessed via
> the perf_aux_output_* functions, which cannot race with each other for a
> given ring buffer.
>
> This patch changes the type of the members to long, so we can avoid
> using the local_* API where it isn't needed.
Thanks for digging this up! Some minor nits below.
> @@ -434,12 +434,12 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
> handle->aux_flags |= PERF_AUX_FLAG_OVERWRITE;
>
> aux_head = handle->head;
> - local_set(&rb->aux_head, aux_head);
> + rb->aux_head = aux_head;
> } else {
> handle->aux_flags &= ~PERF_AUX_FLAG_OVERWRITE;
>
> - aux_head = local_read(&rb->aux_head);
> - local_add(size, &rb->aux_head);
> + aux_head = rb->aux_head;
> + rb->aux_head += size;
> }
>
> if (size || handle->aux_flags) {
> @@ -451,11 +451,11 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
> handle->aux_flags);
> }
>
> - aux_head = rb->user_page->aux_head = local_read(&rb->aux_head);
> + aux_head = rb->user_page->aux_head = rb->aux_head;
>
> - if (aux_head - local_read(&rb->aux_wakeup) >= rb->aux_watermark) {
> + if (aux_head - rb->aux_wakeup >= rb->aux_watermark) {
Can't we just do away with aux_head here:
rb->user_page->aux_head = rb->aux_head;
if (rb->aux_head - rb->aux_wakeup >= rb->aux_watermark) { ...
?
> @@ -485,14 +485,13 @@ int perf_aux_output_skip(struct perf_output_handle *handle, unsigned long size)
> if (size > handle->size)
> return -ENOSPC;
>
> - local_add(size, &rb->aux_head);
> + rb->aux_head += size;
>
> - aux_head = rb->user_page->aux_head = local_read(&rb->aux_head);
> - if (aux_head - local_read(&rb->aux_wakeup) >= rb->aux_watermark) {
> + aux_head = rb->user_page->aux_head = rb->aux_head;
> + if (aux_head - rb->aux_wakeup >= rb->aux_watermark) {
> perf_output_wakeup(handle);
> - local_add(rb->aux_watermark, &rb->aux_wakeup);
> - handle->wakeup = local_read(&rb->aux_wakeup) +
> - rb->aux_watermark;
> + rb->aux_wakeup += rb->aux_watermark;
> + handle->wakeup = rb->aux_wakeup + rb->aux_watermark;
> }
>
> handle->head = aux_head;
And here I think we don't need aux_head at all.
Thanks,
--
Alex
next prev parent reply other threads:[~2017-07-31 10:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-28 16:54 Will Deacon
2017-07-28 16:54 ` [PATCH 2/2] perf/aux: Ensure aux_wakeup represents most recent wakeup index Will Deacon
2017-07-31 10:02 ` Alexander Shishkin
2017-08-04 14:42 ` Will Deacon
2017-07-31 10:28 ` Alexander Shishkin [this message]
2017-08-04 14:58 ` [PATCH 1/2] perf/aux: Make aux_{head,wakeup} ring_buffer members long Will Deacon
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=87ini8uci6.fsf@ashishki-desk.ger.corp.intel.com \
--to=alexander.shishkin@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=peterz@infradead.org \
--cc=will.deacon@arm.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
Powered by JetHome