Skip to content
  • Jan Beulich's avatar
    x86: Fix and improve cmpxchg_double{,_local}() · cdcd6298
    Jan Beulich authored
    Just like the per-CPU ones they had several
    Only the first memory operand was mentioned in the asm()
    operands, and the 2x64-bit version didn't have a memory clobber
    while the 2x32-bit one did. The former allowed the compiler to
    not recognize the need to re-load the data in case it had it
    cached in some register, while the latter was overly
    The types of the local copies of the old and new values were
    incorrect (the types of the pointed-to variables should be used
    here, to make sure the respective old/new variable types are
    The __dummy/__junk variables were pointless, given that local
    copies of the inputs already existed (and can hence be used for
    discarded outputs).
    The 32-bit variant of cmpxchg_double_local() referenced
    At once also:
     - change the return value type to what it really is: 'bool'
     - unify 32- and 64-bit variants
     - abstract out the common part of the 'normal' and 'local' variants
    Signed-off-by: default avatarJan Beulich <>
    Cc: Christoph Lameter <>
    Cc: Linus Torvalds <>
    Cc: Andrew Morton <>
    Signed-off-by: default avatarIngo Molnar <>