Zum Hauptinhalt springen
Intelligence View
⚡ tsecurity.de Intelligence

acquire/release semantics in the kernel

With the need for better scaling on increasingly larger multi-core systems, we've continued to extend our CPU barriers in the kernel. Two important variants to…

Beitrag
0
Seite
0
↗ Quelle (blog.stgolabs.net)
Cloud & Tech-Stack · 4 Min. Lesezeit
Quelle: blog.stgolabs.net
Rubrik: Unix & Linux Server


With the need for better scaling on increasingly larger multi-core
systems, we've continued to extend our CPU barriers in the kernel. Two important variants to prevent CPU reordering for lock-free shared memory synchronization are pairs of load/acquire and store/release barriers; also known as LOCK/UNLOCK barriers. These enable threads to cooperate between each other.



Multiple, yet pretty much equivalent, definitions of acquire/release semantics can be found all over the internet, but I like the version from the infamous 'Documentation/memory-barriers.txt' file for three reasons: (i) it is clear and concise, (ii) it explicitly warns that they are the minimum operations and not to assume anything about reordering of loads and stores before or after the acquire or release, respectively. Finally, (iii) it strongly mentions the need for pairing and thus portability:



 (5) ACQUIRE operations.

     This acts as a one-way permeable barrier.  It guarantees that all memory operations after the ACQUIRE operation will appear to happen after the CQUIRE operation with respect to the other components of the system. ACQUIRE operations include LOCK operations and smp_load_acquire() operations.

     Memory operations that occur before an ACQUIRE operation may appear tohappen after it completes.

     An ACQUIRE operation should almost always be paired with a RELEASE operation.




 (6) RELEASE operations.

     This also acts as a one-way permeable barrier.  It guarantees that all   memory operations before the RELEASE operation will appear to happen before the RELEASE operation with respect to the other components of the system. RELEASE operations include UNLOCK operations and smp_store_release() operations.

     Memory operations that occur after a RELEASE operation may appear to happen before it completes.

     The use of ACQUIRE and RELEASE operations generally precludes the need for other sorts of memory barrier (but note the exceptions mentioned in the subsection "MMIO write barrier").  In addition, a RELEASE+ACQUIRE pair is -not- guaranteed to act as a full memory barrier.  However, after an ACQUIRE on a given variable, all memory accesses preceding any prior RELEASE on that same variable are guaranteed to be visible.  In other words, within a given variable's critical section, all accesses of all previous critical sections for that variable are guaranteed to have completed.

     This means that ACQUIRE acts as a minimal "acquire" operation and    RELEASE acts as a minimal "release" operation.




Thread B's ACQUIRE pairs with Thread A's RELEASE. Copyright (C) IBM.






In lock-speak, all this means is that nothing leaks from the critical region that is protected by the primitive in question. A thread attempting to take a lock will synchronize/pair the load (ACQUIRE), for instance via Rmw (cmpxchg), when attempting to take the lock with the last store (RELEASE) when another thread is concurrently releasing the lock (for example, setting the counter to 0).





For v4.2, Will Deacon introduced more relaxed extensions of traditional atomic operations (including Rmw) which allow finer grained control over, what used to be, full barriers semantics on both sides of the instruction. This is also true for just about all atomic functions that return a value to the caller, ie: atomic_*_return(). As such weakly ordered architectures can make use of these -- currently only arm64 makes use of them, but efforts for PPC are being made.



      - *_relaxed: No ordering guarantees. This is similar to what we have already for the non-return atomics (e.g. atomic_add).
  
      - *_acquire: ACQUIRE semantics, similar to smp_load_acquire.
  
      - *_release: RELEASE semantics, similar to smp_store_release.



So we now have goodies such as atomic_cmpxchg_acquire() or atomic_add_return_relaxed(). Most recently, aiming for v4.4, I've ported all our locks to make use of these optimizations, which can save almost half the
amount of barriers in the kernel's locking code -- which is specially nice under low or regular contention scenarios,
where the fastpaths are exercised. There are plenty of other examples of real world code making use of acquire/release semantics. Mostly by using smp_load_acquire()/smp_store_release() other primitives  also use these semantics for common building blocks (as esoteric as they can get, ie RCU).

Social ReaktionenReagiere als Erste:r — dein Feedback zählt!
Informations-Bewertung:
✏️ Information ergänzen
🛡️ Versioniert via CMS-Revisions-Engine (Freigabe-Queue für Gäste)

💬 Community discussion & comments

🌐 Join the main chat

Start the discussion in the Social Chat broadcast stream or submit an expert contribution via the supplement form above.

Security Briefing Free · 1-Click Unsubscribe

Intelligence Digest — free

The top security news daily · unsubscribe anytime

Community Rating & Social Proof
⭐ Reader Rating
–
Ø / 5.0
No reader ratings yet
Was this article helpful?
0
Submit your rating
Detailed rating (optional)
Content & Quality
Source & Credibility
Freshness

Related story clusters & sources (vector AI)

6 Cluster
19 sources
Bluetti Black Friday: Drei empfehlenswerte Powerstations günstiger
ifun.de 21 min. ago
18 more sources
CNET21 hours agoI Test Air Fryers. Cuisinart’s Glass Model Is a Steal at $84 for Black Friday t3n.de1 hour agoBlack Friday: Diese 9 Fritzboxen, Repeater und Co. sind wirklich günstig Golem.de52 min. agoAnzeige: Leises Rudergerät zum Black Friday günstig wie nie bei Amazon heise online News41 min. agoBlack Friday: Bei Saugrobotern kräftig sparen – Topmodelle zum Tiefstpreis AppleInsider News40 min. agoBlack Friday price war drops Apple's M6 MacBook Pro to $1,779 WinFuture News1 hour agoBlack-Friday-Deal: Lymow One Plus, der Panzer unter den Mährobotern netzwelt.de2 hours agoXiaomi TV F Pro im Black-Friday-Check: Wie gut ist der Fernseher-Hit wirklich? netzwelt.de1 hour agoWer eine Nintendo Switch 2 sucht, sollte sich diese Black-Friday-Aktion bei congstar anschauen Computer Bild1 hour agoBlack Friday: Die besten Girokonto-Deals PC-WELT1 hour agoAmazon Black Friday Woche am Dienstag: Die besten Technik-Deals im Überblick PC-WELT1 hour agoFritzbox 7690 mit Wi-Fi 7 bei Amazon im Black-Friday-Angebot: Jetzt deutlich günstiger Latest from TechRadar1 hour agoProton VPN Plus vs Surfshark One: which plan is the better Black Friday deal right now? Latest from TechRadar1 hour agoBlack Friday Oura Ring deals: The best of the deals so far, picked by a wearable-tech expert CNET6 years agoOur Favorite Blenders of 2026 Are on Sale Ahead of Black Friday CNET1 hour agoBrighten Up Your Day by Saving 20% Off Flashlights With Olight’s Black Friday Sale CNET1 hour agoLive: Black Friday Deals Are Here. Shop Expert Picks Across Tech, Everyday Essentials and More at Up to 60% Off Golem.de1 hour agoAnzeige: Logitech-Tastatur MX Keys S am Black Friday zum Sensationspreis auf Amazon PC-WELT2 hours agoLuminar zum Black Friday: KI-Bildbearbeitung für nur 79,20 Euro
17 sources
CVE-2026-133764 | Twig up to 3.31.0 Sandbox toString sandbox (EUVD-2026-133913)
VulDB Updates 51 min. ago
16 more sources
VulDB Updates51 min. agoCVE-2026-133763 | Symfony Twig up to 3.31.0 Sandbox toString sandbox (EUVD-2026-133912) VulDB Updates51 min. agoCVE-2026-132270 | Significant-Gravitas AutoGPT up to 0.8.4 Autopilot authorization (EUVD-2026-133583) VulDB Updates51 min. agoCVE-2026-136123 | Friendica up to 2026.05-1 ActivityPub compactProfile input validation (EUVD-2026-133909) VulDB Updates51 min. agoCVE-2026-136124 | welovemedia ffmate up to 2.0.x wildcardReplacer argument injection (EUVD-2026-133908) VulDB Updates1 hour agoCVE-2026-72522 | Libexpat up to 2.8.2 Unicode *_toUtf16 out-of-bounds (EUVD-2026-54990 / Nessus ID 385514) VulDB Updates1 hour agoCVE-2026-133773 | Twig markdown-extra up to 3.31.0 HtmlConverter html_to_markdown options resource consumption (EUVD-2026-133922) VulDB Updates1 hour agoCVE-2026-133772 | Twig up to 3.30.x Sandbox sandbox (EUVD-2026-133921) VulDB Updates1 hour agoCVE-2026-133770 | Twig up to 3.31.0 Sandbox __construct sandbox (EUVD-2026-133919) VulDB Updates1 hour agoCVE-2026-133769 | Symfony html-extra up to 3.31.0 Cva Cva::apply sandbox (EUVD-2026-133918) VulDB Updates1 hour agoCVE-2026-133767 | Twig up to 3.31.0 Sandbox __toString sandbox (EUVD-2026-133916) VulDB Updates1 hour agoCVE-2026-133766 | Twig up to 3.31.0 Sandbox toString sandbox (EUVD-2026-133915) VulDB Updates1 hour agoCVE-2026-133765 | Symfony Twig up to 3.31.0 Sandbox sandbox (EUVD-2026-133914) VulDB Updates2 hours agoCVE-2026-13137 | Hitachi Energy RTU500 CMU up to 13.9.1 User management/REST resolver/SPA-Bus buffer overflow (EUVD-2026-133827) VulDB Updates2 hours agoCVE-2026-131717 | Liquid Web, StellarWP Event Tickets Plugin up to 5.31.1 on WordPress authorization (EUVD-2026-131354) VulDB Updates2 hours agoCVE-2026-126605 | Proton Pass up to 1.21.0 Face ID App Lock improper authentication (EUVD-2026-133826) VulDB Updates2 hours agoCVE-2026-103406 | Juniper Session Smart Conductor up to 7.0.4/7.1.6/7.2.2 AutomatedProvisioner os command injection (EUVD-2026-112215)
Similar posts
🔍 Verwandte News

Auch interessante Nachrichten acquire/release semantics in the kernel

Thematisch verwandte Begriffe: acquirerelease, semantics, kernel · 6 Treffer

Laden...

Loading videos ...

Laden...

Loading posts ...

Laden...

Loading videos ...

Laden...

Loading posts ...

Laden...

Loading videos ...

Laden...

Loading posts ...

Laden...

Loading videos ...

💬 Loading comments…
Pull to refresh
Widgets & Topics
Loading widgets…
Nächster Beitrag