"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."
  • Bruno Finger@lemm.ee
    link
    fedilink
    arrow-up
    3
    arrow-down
    2
    ·
    10 months ago
    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.

    • subignition@kbin.social
      link
      fedilink
      arrow-up
      5
      ·
      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

    • BananaTrifleViolin@kbin.social
      link
      fedilink
      arrow-up
      1
      ·
      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.