this post was submitted on 14 Nov 2023
-41 points (37.7% liked)

Linux

47237 readers
3343 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

"The min_granularity setting was renamed to base_slice in this commit in v6 kernel.

The comment says it scales with CPU count and the comment is incorrect. I wonder whether kernel developers are aware of that mistake as they are rewriting the scheduler!

  • Official comments in the code says it’s scaling with log2(1+cores) but it doesn’t.
  • All the comments in the code are incorrect.
  • Official documentation and man pages are incorrect.
  • Every blog article, stack overflow answer and guide ever published about the scheduler is incorrect."
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 66 points 10 months ago* (last edited 10 months ago) (1 children)

Wish this BS article would stop getting posted everywhere.

This article is clickbait and in no way has the kernel been hardcoded to a maximum of 8 cores. If you read the commit [0], you can see, that a /certain/ scaling factor for scheduling can scale linearly or logarithmically with the number of cores and for calculating this scaling factor, the number is capped to 8. This has nothing to do with the number of cores that can actually be used.

[0] https://github.com/torvalds/linux/commit/acb4a848da821a095ae9e4d8b22ae2d9633ba5cd

[–] [email protected] 1 points 10 months ago (2 children)
unsigned int cpus = min(num_online_cpus(), 8);

doesn't that mean it's actually at least 8, as in if you have 4 cores cpus will be assigned 8, if you have 20 cores cpus will be assigned 20.

[–] [email protected] 5 points 10 months ago

No, I think min() returns the lower of two arguments. If you had 4 cores, min(4, 8) == 4, and if you had 20 cores, min(20, 8) == 8

[–] [email protected] 1 points 10 months ago

Yeah I was wondering this too - is 8 the floor, 8 cores or below the value is always the same, but above 8 cores you then get your log progression? I don't know enough about this though.