lkml.org 
[lkml]   [2024]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [WIP 0/3] Memory model and atomic API in Rust
On Mon, Apr 08, 2024 at 10:01:32AM -0700, Linus Torvalds wrote:

> For our own historical reasons, while we have a few generic atomic
> operations: bit operations, cmpxchg, etc, most of our arithmetic and
> logical ops all rely on a special "atomic_t" type (later extended with
> "atomic_long_t").
>
> The reason? The garbage that is legacy Sparc atomics.
>
> Sparc historically basically didn't have any atomics outside of the
> 'test and set byte' one, so if you wanted an atomic counter thing, and
> you cared about sparc, you had to play games with "some bits of the
> counter are the atomic byte lock".
>
> And we do not care about that Sparc horror any *more*, but we used to.

FWIW, PA-RISC is no better - the same "fetch and replace with constant"
kind of primitive as for sparc32, only the constant is (u32)0 instead
of (u8)~0. And unlike sparc64, 64bit variant didn't get better.

\
 
 \ /
  Last update: 2024-05-27 16:29    [W:0.117 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site