]> git.baikalelectronics.ru Git - kernel.git/commit
x86/alternatives: Use atomic_xchg() instead atomic_dec_and_test() for stop_machine_te...
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Thu, 7 Jun 2012 13:20:18 +0000 (22:20 +0900)
committerIngo Molnar <mingo@kernel.org>
Wed, 13 Jun 2012 13:08:37 +0000 (15:08 +0200)
commit5f0dd34c8056a6bdd02c92e9a62b452a150c6ed4
treee5ccff03a7fda3be1217923d973e8ba2f405a531
parent79f12efcebc712903830b6a1da347111f4356166
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: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
[ Rewrote changelog ]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/87zk8fgsx9.fsf@devron.myhome.or.jp
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/alternative.c