Skip to content
Commit 5cd08fbf authored by Jason Baron's avatar Jason Baron Committed by Ingo Molnar
Browse files

sched: Fix static_key race with sched_feat()



As pointed out by Andi Kleen, the usage of static keys can be racy in
sched_feat_disable() vs. sched_feat_enable(). Currently, we first check the
value of keys->enabled, and subsequently update the branch direction. This,
can be racy and can potentially leave the keys in an inconsistent state.

Take the i_mutex around these calls to resolve the race.

Reported-by: default avatarAndi Kleen <andi@firstfloor.org>
Signed-off-by: default avatarJason Baron <jbaron@akamai.com>
Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: rostedt@goodmis.org
Link: http://lkml.kernel.org/r/9d7780c83db26683955cd01e6bc654ee2586e67f.1404315388.git.jbaron@akamai.com
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 6e76ea8a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment