lkml.org 
[lkml]   [2024]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip: locking/core] locking/atomic/x 86: Introduce arch try cmpxchg64 local()
On April 17, 2024 9:21:29 PM GMT+02:00, Uros Bizjak <ubizjak@gmail.com> wrote:
>The above is perhaps a little unfortunate example taken from
>
>if (cmpxchg64(...))
>
>where the check is against zero. The compiler can optimize the check
>to a TEST insn in this particular case, but otherwise CMP will be
>emitted for different usages. Not a big difference, but a register has
>to be kept live across cmpxchg8b.
>
...
>
>There is one important issue. When a register (or two for double-word
>values) has to be kept live for a compare, the register pressure on
>32bit targets around cmpxchg8b goes through the roof, and when using
>the frame pointer (and maybe some fixed register, e.g. PIC), the
>register allocator runs out of available registers. The number of
>spills around cmpxchg8b signals the troubles register allocator goes
>through to "fix" everything, so from the compiler PoV any relief is
>more than welcome here. Even in GCC internal libraries, we have had to
>take a special approach with this insn to avoid internal compiler
>errors. The kernel was quite lucky here ;)

That would've been a lot better reason to justify the change. I think you should put those things in the commit messages.

Thx.


--
Sent from a small device: formatting sucks and brevity is inevitable.

\
 
 \ /
  Last update: 2024-04-18 12:55    [W:0.033 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site