Re: [PATCH] mm: Handle ksize() vs __alloc_size by forgetting size
From: Matthew Wilcox
Date: Mon Feb 28 2022 - 09:30:37 EST
On Mon, Feb 28, 2022 at 12:24:51PM +0100, Marco Elver wrote:
> 2. Somehow statically computing the size-class's size (kmalloc_index()
> might help here), removing __alloc_size from allocation functions and
> instead use some wrapper.
I don't think that's computable. I have been thinking about a slab flag
that would say "speed is more important than size; if the smallest slab
for this size of allocation has no free objects, search larger slabs
to get memory instead of allocating a new slab". If we did have such
a feature, it would be impossible to know how large ksize() would report.