On Sat, 20 Apr 2024, Hyunmin Lee wrote:
For SLAB the kmalloc caches needed to be created in ascending sizes in order. However, the constraint is not necessary anymore because SLAB has been deprecated and SLUB doesn't need to comply with the constraint. Thus, kmalloc 96 and 192 caches can be created after the other size kmalloc caches are created instead of checking every time to find their order to be created. Also, this change could prevent engineers from being confused by the deprecated constraint.
Ok but you are creating index 1 2 after going through KMALLOC_SHIFT_LOW to KMALLOC_SHIFT_HIGH. 1 and 2 should come before the loop in order to make it easily readable.
At that point you can also skip the check for the kmalloc caches already being present I think.