summaryrefslogtreecommitdiff
path: root/lib/mpi/mpi-add.c
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2022-06-29 17:15:52 +0200
committerPeter Zijlstra <peterz@infradead.org>2022-07-04 09:23:08 +0200
commitc02d5546ea34d589c83eda5055dbd727a396642b (patch)
tree6264e7eb7c29978562f5e24f296523e776d9c1dd /lib/mpi/mpi-add.c
parent1fcf54deb767d474181ad7cf33c92bb2a33607fb (diff)
sched/core: Use try_cmpxchg in set_nr_{and_not,if}_polling
Use try_cmpxchg instead of cmpxchg (*ptr, old, new) != old in set_nr_{and_not,if}_polling. x86 cmpxchg returns success in ZF flag, so this change saves a compare after cmpxchg. The definition of cmpxchg based fetch_or was changed in the same way as atomic_fetch_##op definitions were changed in e6790e4b5d5e97dc287f3496dd2cf2dbabdfdb35. Also declare these two functions as inline to ensure inlining. In the case of set_nr_and_not_polling, the compiler (gcc) tries to outsmart itself by constructing the boolean return value with logic operations on the fetched value, and these extra operations enlarge the function over the inlining threshold value. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20220629151552.6015-1-ubizjak@gmail.com
Diffstat (limited to 'lib/mpi/mpi-add.c')
0 files changed, 0 insertions, 0 deletions