On Thu, Nov 12, 2020 at 12:06 AM Marco Elver <elver@xxxxxxxxxx> wrote: > > > + /* Limit it with KMALLOC_MAX_SIZE (relevant for SLAB only). */ > > + if (optimal_size > KMALLOC_MAX_SIZE) > > + optimal_size = KMALLOC_MAX_SIZE; > > + /* Use optimal size if the size with added metas is not large enough. */ > > Uses the optimal size if it's not "too large" rather than "not large > enough", right? Not really. If the redzone composed from metas is begger than optimal redzone - we're good. If it's not large enough to reach optimal redzone - we need to make it bigger. > As it is worded now makes me think this is a fallback, > whereas ideally it's the common case, right? It's hard to say which case is more common, as optimal redzone size varies and depends on the object size. [...] Will fix the rest of the comments, thanks!