Uros Bizjak 70ec04f348 zram: use try_cmpxchg in update_used_max
Use try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in
update_used_max.  x86 CMPXCHG instruction returns success in ZF flag, so
this change saves a compare after cmpxchg (and related move instruction in
front of cmpxchg).

Also, reorder code a bit to remove additional compare and conditional jump
from the assembly code.  Together, hese two changes save 15 bytes from the
function when compiled for x86_64.

No functional change intended.

Link: https://lkml.kernel.org/r/20221018145154.3699-1-ubizjak@gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-11-08 17:37:13 -08:00
..
2022-10-21 15:14:14 -07:00
2022-10-07 12:05:29 -07:00
2022-09-03 13:23:11 -07:00
2022-06-28 06:33:15 -06:00
2022-06-28 06:33:15 -06:00
2022-07-14 12:14:31 -06:00
2022-08-02 17:22:46 -06:00
2022-06-28 06:33:15 -06:00
2022-10-07 17:04:10 -07:00
2022-06-28 06:33:15 -06:00
2022-06-28 06:33:15 -06:00
2022-06-28 06:33:15 -06:00
2022-06-28 06:33:15 -06:00
2022-10-10 14:02:53 -07:00
2022-09-03 13:23:11 -07:00
2022-06-28 06:33:15 -06:00