Uros Bizjak 04ec006171 mm/page_alloc: use try_cmpxchg in set_pfnblock_flags_mask
Use try_cmpxchg instead of cmpxchg in set_pfnblock_flags_mask.  x86
CMPXCHG instruction returns success in ZF flag, so this change saves a
compare after cmpxchg (and related move instruction in front of cmpxchg). 
The main loop improves from:

    1c5d:	48 89 c2             	mov    %rax,%rdx
    1c60:	48 89 c1             	mov    %rax,%rcx
    1c63:	48 21 fa             	and    %rdi,%rdx
    1c66:	4c 09 c2             	or     %r8,%rdx
    1c69:	f0 48 0f b1 16       	lock cmpxchg %rdx,(%rsi)
    1c6e:	48 39 c1             	cmp    %rax,%rcx
    1c71:	75 ea                	jne    1c5d <...>

to:

    1c60:	48 89 ca             	mov    %rcx,%rdx
    1c63:	48 21 c2             	and    %rax,%rdx
    1c66:	4c 09 c2             	or     %r8,%rdx
    1c69:	f0 48 0f b1 16       	lock cmpxchg %rdx,(%rsi)
    1c6e:	75 f0                	jne    1c60 <...>

Link: https://lkml.kernel.org/r/20220708140736.8737-1-ubizjak@gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-07-17 17:14:47 -07:00
..
2021-05-05 11:27:24 -07:00
2022-03-24 19:06:45 -07:00
2022-05-13 07:20:09 -07:00
2022-02-14 19:51:47 +01:00
2022-03-23 18:03:08 -07:00
2022-06-16 19:48:30 -07:00
2022-05-13 07:20:09 -07:00
2022-07-17 17:14:41 -07:00
2022-03-22 17:03:12 -07:00
2022-05-26 16:57:20 -07:00
2021-05-07 00:26:35 -07:00
2022-05-09 23:12:53 -04:00
2022-05-25 10:24:04 -07:00
2022-03-22 18:26:56 -07:00
2022-06-04 14:04:27 -07:00
2022-01-15 16:30:31 +02:00
2022-05-19 14:08:53 -07:00