From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf: Explain perf_sched_mutex
Date: Tue, 29 Aug 2017 17:04:22 +0300 [thread overview]
Message-ID: <87h8wqxyft.fsf@ashishki-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20170829140103.6563-1-alexander.shishkin@linux.intel.com>
Alexander Shishkin <alexander.shishkin@linux.intel.com> writes:
> To clarify why atomic_inc_return(&perf_sched_events) is not sufficient and
> a mutex is needed to order static branch enabling vs the atomic counter
> increment, this adds a comment with an short explanation.
"with a short explanation", sigh
>
> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> ---
> kernel/events/core.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index efe09b8c38..2c8719b635 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -9569,6 +9569,11 @@ static void account_event(struct perf_event *event)
> inc = true;
>
> if (inc) {
> + /*
> + * We need the mutex here because static_branch_enable()
> + * must complete *before* the perf_sched_count increment
> + * becomes visible.
> + */
> if (atomic_inc_not_zero(&perf_sched_count))
> goto enabled;
>
> --
> 2.14.1
next prev parent reply other threads:[~2017-08-29 14:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 14:01 [PATCH] perf: Explain perf_sched_mutex Alexander Shishkin
2017-08-29 14:04 ` Alexander Shishkin [this message]
2017-09-29 20:07 ` [tip:perf/core] perf/core: " tip-bot for Alexander Shishkin
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=87h8wqxyft.fsf@ashishki-desk.ger.corp.intel.com \
--to=alexander.shishkin@linux.intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.