Skip to content
Commit 2f747590 authored by OGAWA Hirofumi's avatar OGAWA Hirofumi Committed by Ingo Molnar
Browse files

x86/alternatives: Use atomic_xchg() instead atomic_dec_and_test() for stop_machine_text_poke()



stop_machine_text_poke() uses atomic_dec_and_test() to select one of
the CPUs executing that function to actually modify the code.

Since the variable is initialized to 1, subsequent CPUs will make the
variable go negative. Since going negative is uncommon/unexpected in
typical dec_and_test usage change this user to atomic_xchg().

This was found using a patch that warns on dec_and_test going
negative.

Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
[ Rewrote changelog ]
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/87zk8fgsx9.fsf@devron.myhome.or.jp


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent b0a4c6f2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment