• Uros Bizjak's avatar
    drm/amdgpu: Use local64_try_cmpxchg in amdgpu_perf_read · 9e761bff
    Uros Bizjak authored
    Use local64_try_cmpxchg instead of local64_cmpxchg (*ptr, old, new) == old
    in amdgpu_perf_read.  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, try_cmpxchg implicitly assigns old *ptr value to "old" when cmpxchg
    fails. There is no need to re-read the value in the loop.
    
    No functional change intended.
    
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: "Christian König" <christian.koenig@amd.com>
    Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
    Cc: David Airlie <airlied@gmail.com>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    9e761bff
amdgpu_pmu.c 18 KB