Comments
Hacker News
by CamperBob2
by jeffbee
by ot
This is mentioned in the source comment, but not documented in the membarrier(2) manual page.
https://elixir.bootlin.com/linux/v7.1.2/source/kernel/sched/...
In reality... what is it allocating?
https://elixir.bootlin.com/linux/v7.1.2/source/kernel/sched/...
Ok, so it needs to allocate a cpumask (tiny) under some usages.
Similar requirement in other sites, e.g.: https://elixir.bootlin.com/linux/v7.1.2/source/kernel/sched/...
Depending on kernel config (e.g., !CONFIG_CPUMAKS_OFFSTACK), this allocation literally cannot fail:
https://elixir.bootlin.com/linux/v7.1.2/source/include/linux...
On OFFSTACK configs, it's merely a tiny heap allocation:
https://elixir.bootlin.com/linux/v7.1.2/source/lib/cpumask.c...
If this fails, your system is already hosed; program abort vs kernel lock up a few seconds later is probably immaterial. I think folly's choice to abort is a reasonable one.
by loeg
by KenoFischer
For me, the reading that made asymmetric fences "click" is this: https://pvk.ca/Blog/2019/01/09/preemption-is-gc-for-memory-r...
It might be easier to read that first, as it also goes into practical applications, and then this one.
by ot
by fschutze
Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- Claude, deal with thisby CamperBob2
- I can't help myself digging into the referenced source code. The membarrier syscall can fail to allocate, returning ENOMEM. The way Folly calls it, the program would abort. Which I guess is a fair strategy but it's good to know when your synchronization primitive is actually SynchronizeOrCrash.by jeffbee
- In Linux everything is XOrCrash, since allocations never fail but the OOM killer can get you later.by ot
- > The membarrier syscall can fail to allocate, returning ENOMEM.
This is mentioned in the source comment, but not documented in the membarrier(2) manual page.
https://elixir.bootlin.com/linux/v7.1.2/source/kernel/sched/...
In reality... what is it allocating?
https://elixir.bootlin.com/linux/v7.1.2/source/kernel/sched/...
Ok, so it needs to allocate a cpumask (tiny) under some usages.
Similar requirement in other sites, e.g.: https://elixir.bootlin.com/linux/v7.1.2/source/kernel/sched/...
Depending on kernel config (e.g., !CONFIG_CPUMAKS_OFFSTACK), this allocation literally cannot fail:
https://elixir.bootlin.com/linux/v7.1.2/source/include/linux...
On OFFSTACK configs, it's merely a tiny heap allocation:
https://elixir.bootlin.com/linux/v7.1.2/source/lib/cpumask.c...
If this fails, your system is already hosed; program abort vs kernel lock up a few seconds later is probably immaterial. I think folly's choice to abort is a reasonable one.
by loeg - I also just added these to Julia for 1.14 (https://github.com/JuliaLang/julia/pull/60311).by KenoFischer
- This is a great article but it goes into a lot of detail that can be intimidating at first.
For me, the reading that made asymmetric fences "click" is this: https://pvk.ca/Blog/2019/01/09/preemption-is-gc-for-memory-r...
It might be easier to read that first, as it also goes into practical applications, and then this one.
by ot - Thanks, this is very useful. Reading it I was wondering how applications typically exploit the asymmetric fence, I hope the article you linked help in that regard.by fschutze
Related stories
Decoding the obfuscated bash script on a Uniqlo t-shirt
tris.sherliker.net · 1072 points · 181 comments
StreetComplete: Fixing OpenStreetMap, one tiny quest at a time
streetcomplete.app · 761 points · 182 comments
Every new car sold in the European Union must include a driver monitoring camera
allaboutcookies.org · 737 points · 969 comments
Chat Control 1.0 and 2.0 Explained
fightchatcontrol.eu · 645 points · 238 comments
Microsoft fire idTech team at Id software
gamefromscratch.com · 597 points · 533 comments
Chat Control passed first round in EU Parliament
heise.de · 567 points · 246 comments