frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Read_once(), Write_once(), but Not for Rust

https://lwn.net/SubscriberLink/1053142/8ec93e58d5d3cc06/
31•todsacerdoti•1h ago

Comments

gpderetta•56m ago
Very interesting. AFAIK the kernel explicitly gives consume semantics to read_once (and in fact it is not just a compiler barrier on alpha), so technically lowering it to a relaxed operation is wrong.

Does rust have or need the equivalent of std::memory_order_consume? Famously this was deemed unimplementable in C++.

steveklabnik•49m ago
It wasn’t implemented for the same reason. Rust uses C++20 ordering.
gpderetta•40m ago
right, so I would expect that the equivalent of READ_ONCE is converted to an acquire in rust, even if slightly pessimal.

But the article says that the suggestion is to convert them to relaxed loads. Is the expectation to YOLO it and hope that the compiler doesn't break control and data dependencies?

bonzini•38m ago
There is a yolo way that actually works, which would be to change it to a relaxed load followed by an acquire signal fence.
loeg•29m ago
Is that any better than just using an acquire load?
gpderetta•28m ago
It is cheaper on ARM and POWER. But I'm not sure it is always safe. The standard has very complex rules for consume to make sure that the compiler didn't break the dependencies.

edit: and those rules where so complex that compilers decided where not implementable or not worth it.

loeg•28m ago
Does anything care about Alpha? The platform hasn't been sold in 20 years.
gpderetta•22m ago
consume is trivial on alpha, it is the same as acquire (always needs a #LoadLoad). It is also the same as acquire (and relaxed) on x86 and SPARC (a plain load, #LoadLoad is always implied).

The only place where consume matters is on relaxed but not too relaxed architectures like ARM and POWER, where consume relies on the implicit #LoadLoad of controls and data dependencies.

jcranmer•9m ago
It's a persistent misunderstanding that release-consume is about Alpha. It's not; in fact, Alpha is one of the few architectures where release-consume doesn't help.

In a TSO architecture like x86 or SPARC, every "regular" memory load/store is effectively a release/acquire by default. Using release/consume or relaxed provides no extra speedup on these architectures. In weak memory models, you need to add in acquire barriers to get release/acquire architectures. But also, most weak memory models have a basic rule that a data-dependent load has an implicit ordering dependency on the values that computed it (most notably, loading *p has an implicit dependency on p).

The goal of release/consume is to be able to avoid having an acquire fence if you have only those dependencies--to promote a hardware data dependency semantic rule to a language-level semantic rule. For Alpha's ultra-weak model, you still need the acquire fence in this mode, it doesn't help Alpha one whit. Unfortunately, for various reasons, no one has been able to work out a language-level semantics for consume that compilers are willing to implement (preserving data dependencies through optimizations is a lot more difficult than it appears), so all compilers have remapped consume to acquire, making it useless.

chrismsimpson•54m ago
> The truth of the matter, though, is that the Rust community seems to want to take a different approach to concurrent data access.

Not knowing anything about development of the kernel, does this kind of thing create a two tier Linux development experience?

zaphar•41m ago
Not sure if it introduces a tiered experience or not. But reading the article it appears that the Rust devs advocated for an api that is clearer in it's semantics with the tradeoff that now understanding how it interacts with C code requires understanding two APIs. How this shakes out in practice remains to be seen.
epolanski•28m ago
What is your take on their names instead of "atomic_read" and "atomic_write"?
bheadmaster•17m ago

    An understanding of READ_ONCE() and WRITE_ONCE() is important for kernel developers who will be dealing with any sort of concurrent access to data. So, naturally, they are almost entirely absent from the kernel's documentation.
Made me chuckle.

Show HN: Typestone – A TypeScript validation library with strong type safety

https://github.com/itskyedo/typestone
2•itskyedo•35s ago•0 comments

Vibe Marketing Tool

https://getpixel.ai/
1•nandorsky•1m ago•0 comments

Show HN: I'm building an open source platform for learning Arabic dialects

https://www.parallel-arabic.com/about
1•selmetwa•1m ago•0 comments

From Tokens to Burgers: A Water Footprint Face-Off (AI Water Use)

https://newsletter.semianalysis.com/p/from-tokens-to-burgers-a-water-footprint
1•atlasunshrugged•2m ago•0 comments

Building Debian Packages on Arch Linux with Systemd-Nspawn

https://blog.jlcarveth.dev/post/systemd-nspawn.md
1•JLCarveth•2m ago•0 comments

Exiled crown prince urges world to help protesters topple Iran's government

https://www.bbc.com/news/articles/c70lx085z85o
1•tartoran•3m ago•0 comments

Canada, China slash EV, canola tariffs in reset of ties

https://www.reuters.com/world/china/canada-china-set-make-historic-gains-new-partnership-says-car...
1•DustinEchoes•3m ago•0 comments

Google AI Studio's API key protection is as exposed as the key itself

https://github.com/qudent/qudent.github.io/blob/master/_posts/2026-01-16-aistudio-proxy.md
1•qudent•3m ago•1 comments

BitCraft Open Sourcing Announcement

https://bitcraftonline.com/news/bitcraft-open-sourcing-update
1•cloutiertyler•3m ago•0 comments

Libfaketime modifies the system time for a single application

https://github.com/wolfcw/libfaketime
1•nateb2022•5m ago•0 comments

Why Politics Appear

https://yusufaytas.com/why-politics-appear/
7•yusufaytas•6m ago•0 comments

Agentbox: Contain your coding agents (literally)

https://github.com/rcarmo/agentbox
1•rcarmo•7m ago•0 comments

Poor's Man Shaders

https://nullonerror.org/2025/07/29/poor-s-man-shaders/
2•delduca•7m ago•0 comments

How to Use AI with Goose

https://github.com/block/goose/blob/main/HOWTOAI.md
1•mooreds•9m ago•0 comments

If your name is not Geoffrey Huntley then do not use loom

https://github.com/ghuntley/loom
1•3dsnano•9m ago•0 comments

/R/Atlanta Has New Mods: Here's What Happened

https://old.reddit.com/r/Atlanta/comments/1qbabii/ratlanta_has_new_mods_heres_what_happened/
1•echelon•11m ago•2 comments

Stop Ranking, Start Steering (AI Models)

https://loopjournal.substack.com/p/stop-ranking-start-steering-how-to
1•rmmartins•12m ago•0 comments

AI Weiwei: 'You in the West Can't Compete with China'

https://www.thetimes.com/culture/art/article/ai-weiwei-chinese-artist-taiwan-lx7qghv77
2•ilamont•12m ago•1 comments

Monty Hall Project Management: When to switch plans for better outcomes

https://davidlemayian.com/blog/2026/01/15/monty-hall-project-management/
1•davidlemayian•13m ago•0 comments

Ask HN: Is token-based pricing making AI harder to use in production?

1•Barathkanna•13m ago•0 comments

Ask HN: Resources for learning visual design as a developer?

2•chaosharmonic•16m ago•0 comments

What does 2026 hold for Cowboy?

https://micromobility.io/news/what-does-2026-hold-for-cowboy
3•prabinjoel•18m ago•0 comments

Many Small Steps for Robots, One Giant Leap for Mankind

https://www.notboring.co/p/robot-steps
11•cominatchu•19m ago•0 comments

Show HN: Claude Code plugin for ecommerce development

https://github.com/medusajs/medusa-claude-plugins/tree/main/plugins/medusa-dev
2•sebrindom•19m ago•0 comments

Ask HN: What is your knowledge domain and how do you stay up-to-date?

1•ossner•19m ago•1 comments

Emoji Design Convergence Review: 2018 – 2026

https://blog.emojipedia.org/emoji-design-convergence-review-2018-2026/
2•tosh•20m ago•0 comments

High Contrast-ish Gruvbox theme for VS Code

https://marketplace.visualstudio.com/items?itemName=bullptr.highgruv
2•bukharim96•20m ago•0 comments

Is Tehching Hsieh the most extreme performance artist ever?

https://www.theguardian.com/artanddesign/2026/jan/14/tehching-hsieh-most-extreme-performance-arti...
2•bookofjoe•23m ago•0 comments

Ctrl+F All of Manhattan

https://searchable.city
2•seekthenfind•23m ago•1 comments

Show HN: Grow Developer – An idle web game about the journey to a startup 'Exit'

https://www.devgrow.co.kr/en
1•devjun_jun•23m ago•0 comments