Live data from Hacker News

The Linux kernel has been accidentally hardcoded to a maximum of 8 cores

thehftguy.com

11–20 of 58 posts

Re: The Linux kernel has been accidentally hardcoded to a maximum of 8 cores

#12
post #2

> The Linux kernel has been accidentally hardcoded to a maximum of 8 cores for the past 15 years and nobody noticed I can understand having a bug like that, but unnoticed for 15 years? more than 8 cores was rare 15 years ago, and as a percentage of chips sold is still rare, but presumably people with threadrippers ran benchmarks? optimized? etc? just doesn't seem possible

The article is extremely confusingly worded, sometimes close to nonsensical (epyc as baseline? In what damn world?), and definitely clickbaity.

From what I understand what was limited to 8 cores is the scaling of the preemption delay (min_granularity / min_slice). Again from what I understand that what this is is the window during which a process can not be preempted, so this is only relevant when the scheduler has more tasks to run than available slices (the system is heavily / over - loaded).

I would assume well-administered systems where this would be relevant:

1. Are not overloaded

2. Have the important tasks pinned to avoid migrations

3. Have priorities configured to avoid preempting / descheduling their primary workloads

As such, on a well-administered system this would mostly translate to possibly over-pre-empting low-priority tasks (and most likely not pre-empting anything because the machine is configured with capacity for those ancillary / transient low priority tasks). This may show up during transient overloads, and worsen an already bad situation, but it probably wouldn’t show up during normal operations.

It also doesn’t seem accidental, the maintainers literally slapped an `min(8, …)` on there, so they explicitly designed the scaling to have an upper bound. Maybe it’s a mistake, maybe it’s too low, maybe it should be a tunable, but I’d think it makes sense to not allow the preemption delay to grow infinitely.

Re: The Linux kernel has been accidentally hardcoded to a maximum of 8 cores

#13
post #2

> The Linux kernel has been accidentally hardcoded to a maximum of 8 cores for the past 15 years and nobody noticed I can understand having a bug like that, but unnoticed for 15 years? more than 8 cores was rare 15 years ago, and as a percentage of chips sold is still rare, but presumably people with threadrippers ran benchmarks? optimized? etc? just doesn't seem possible

Yeah how come people running massive computers didn’t notice the limit?

Tasks are pinned to cores anyway.

Re: The Linux kernel has been accidentally hardcoded to a maximum of 8 cores

#14
Wow big oooff

One thing I noticed is that min/max functions are tricky to use and it's easily to accidentally do the wrong thing, like in this case

Because you think "you want the minimum (that is, the number should be at least 8) of those numbers to be 8" then you slap min(). And you got it wrong. You should have used max()

Re: The Linux kernel has been accidentally hardcoded to a maximum of 8 cores

#16
this may not be an error.

i’m doing high performance gamedev on a 7950x with smt off. 16 cores.

i can only use 8 to run the game.

mutex and other synchronization gets highly variable latency if the first 8 cores try to talk to the second 8.

i hadn’t heard of this before i started this game, but apparently it’s well known, and nobody makes a chip with more than 8 cores that can have low variability synchronization.

linux running on 8 cores seems like a potentially good idea. one wants the kernel to have low latency with low variability.

Re: The Linux kernel has been accidentally hardcoded to a maximum of 8 cores

#17
Is this an actual bug, or intentional behavior? I mean someone must have put the min in there for a reason…? I can imagine scenarios were it would be nice to have something scale with cores up to a certain point, maybe this is one of those? I didn’t see much analysis beyond “oh hey there is a 8 here that means the kernel people are dumb for 15 years”. Did this get fixed?

Re: The Linux kernel has been accidentally hardcoded to a maximum of 8 cores

#18
> It’s problematic that the kernel was hardcoded to a maximum of 8 cores

Why? The article show no evidence of this being problematic.

> It can’t be good to reschedule hundreds of tasks every few milliseconds, maybe on a different core, maybe on a different die. It can’t be good for performance and cache locality.

Make a PoC and prove it.

Re: The Linux kernel has been accidentally hardcoded to a maximum of 8 cores

#19
post #2

> The Linux kernel has been accidentally hardcoded to a maximum of 8 cores for the past 15 years and nobody noticed I can understand having a bug like that, but unnoticed for 15 years? more than 8 cores was rare 15 years ago, and as a percentage of chips sold is still rare, but presumably people with threadrippers ran benchmarks? optimized? etc? just doesn't seem possible

Yeah how come people running massive computers didn’t notice the limit?

Because the framing is wrong and click bait... As anyone with many cores can tell you: Those are used.

The issue us more subtle: "[the minimum granularity] is supposed to allow tasks to run for a minimum amount of [3ms] when the system is overloaded".

That's supposed to scale with number of cores, but the scaling us limited to 8 cores. However, imho that's not even necessarily a bad thing. It's a trade off between responsiveness and throughput in overload situations. You don't want slices to become too tiny/large...

Post reply on HN