[..] > > Another reason is memory savings, if we have a small subset of objects in > KMALLOC_NORMAL caches accounted, there might be e.g. one vector per a slab > just to account on object while the rest is unaccounted. Separating between > kmalloc and kmalloc-cg caches keeps the former with no vectors and the > latter with fully used vectors. Makes sense. > > > Wouldn't it be easier to special case the specific slab cache used for > > the objcg vector or use a dedicated cache for it instead of using > > kmalloc caches to begin with? > > The problem is the vector isn't a fixed size, it depends on how many objects > a particular slab (not even a particular cache) has. Oh right, I missed that part. Thanks for pointing it out. > > > Anyway, I am fine with any approach you and/or the slab maintainers > > prefer, as long as we make things clear. If you keep the following > > approach as-is, please expand the comment or refer to the commit you > > just referenced. > > > > Personally, I prefer either explicitly special casing the slab cache > > used for the objcgs vector, explicitly tagging KMALLOC_NORMAL > > allocations, or having a dedicated documented helper that finds the > > slab cache kmalloc type (if any) or checks if it is a KMALLOC_NORMAL > > cache. > > A helper to check is_kmalloc_normal() would be better than defining > KMALLOC_TYPE and using it directly, yes. We don't need to handle any other > types now until anyone needs those. is_kmalloc_normal() sounds good to me. Thanks, Vlastimil.