• Linus Torvalds's avatar
    cpumask: re-introduce constant-sized cpumask optimizations · 596ff4a0
    Linus Torvalds authored
    Commit aa47a7c2 ("lib/cpumask: deprecate nr_cpumask_bits") resulted
    in the cpumask operations potentially becoming hugely less efficient,
    because suddenly the cpumask was always considered to be variable-sized.
    
    The optimization was then later added back in a limited form by commit
    6f9c07be ("lib/cpumask: add FORCE_NR_CPUS config option"), but that
    FORCE_NR_CPUS option is not useful in a generic kernel and more of a
    special case for embedded situations with fixed hardware.
    
    Instead, just re-introduce the optimization, with some changes.
    
    Instead of depending on CPUMASK_OFFSTACK being false, and then always
    using the full constant cpumask width, this introduces three different
    cpumask "sizes":
    
     - the exact size (nr_cpumask_bits) remains identical to nr_cpu_ids.
    
       This is used for situations where we should use the exact size.
    
     - the "small" size (small_cpumask_bits) is the NR_CPUS constant if it
       fits in a single word and the bitmap o...
    596ff4a0
.clang-format 20 KB