projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4c4de7d
)
perf/core: Explain perf_sched_mutex
author
Alexander Shishkin
<
[email protected]
>
Tue, 29 Aug 2017 14:01:03 +0000
(17:01 +0300)
committer
Ingo Molnar
<
[email protected]
>
Fri, 29 Sep 2017 11:28:30 +0000
(13:28 +0200)
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 a short explanation.
Signed-off-by: Alexander Shishkin <
[email protected]
>
Signed-off-by: Peter Zijlstra (Intel) <
[email protected]
>
Cc: Linus Torvalds <
[email protected]
>
Cc: Peter Zijlstra <
[email protected]
>
Cc: Thomas Gleixner <
[email protected]
>
Link:
http://lkml.kernel.org/r/
[email protected]
Signed-off-by: Ingo Molnar <
[email protected]
>
kernel/events/core.c
patch
|
blob
|
history
diff --git
a/kernel/events/core.c
b/kernel/events/core.c
index 6bc21e202ae40d36ceb9fa23d3c78785cad957da..5ee62714f9a66d6825507ba5f9dbb2cd9483d858 100644
(file)
--- a/
kernel/events/core.c
+++ b/
kernel/events/core.c
@@
-9394,6
+9394,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;